Like this thread said: Override abstract class in Magento 2 in Magento 1,
I can just create a fully new class.
In Magento 2, we need to use plugins, but plugins only allow me to modify existing methods. What do I have to do if I want to add a new method?
Example:
This class vendor/magento/module-ui/Component/AbstractComponent.php
, has an array of components: $components
, there is no function to unset/delete elements for that array. So how can I create that function?
Best Answer
I don't see how you can do that without completely overriding the class. In the case of your example, you can disable individual components by setting the "disabled" item to the "data" argument in the XML. For instance:
This effectively removes 'title' from the
$components
array.This is due to the
createChildComponent
method in theMagento\Framework\View\Element\UiComponentFactory
class: