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:
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="general">
<field name="title">
<argument name="data" xsi:type="array">
<item name="disabled" xsi:type="boolean">true</item>
</argument>
</field>
</fieldset>
</form>
This effectively removes 'title' from the $components
array.
This is due to the createChildComponent
method in the Magento\Framework\View\Element\UiComponentFactory
class:
protected function createChildComponent(
array $bundleComponents,
ContextInterface $renderContext,
$identifier
) {
list($className, $arguments) = $this->argumentsResolver($identifier, $bundleComponents);
if (isset($arguments['data']['disabled']) && (int)$arguments['data']['disabled']) {
return null;
}
$components = [];
foreach ($bundleComponents['children'] as $childrenIdentifier => $childrenData) {
$children = $this->createChildComponent(
$childrenData,
$renderContext,
$childrenIdentifier
);
$components[$childrenIdentifier] = $children;
}
$components = array_filter($components);
$arguments['components'] = $components;
if (!isset($arguments['context'])) {
$arguments['context'] = $renderContext;
}
return $this->objectManager->create($className, $arguments);
}