0

How to override these below files:

  1. vendor/magento/module-configurable-product/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php
  2. vendor/magento/module-ui/Component/Form.php

ConfigurablePanel.php is defined in vendor/magento/module-ui/etc/adminhtml/di.xml

2 Answers 2

2

In your custom module, app/code/Module/Namespace/etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Ui\Component\Form" type="Module\Namespace\Component\Ui\Form" />
</config>

Then place the Form.php in Module\Namespace\Component\Ui\ path.

Then in that file rewrite,

namespace Module\Namespace\Component\Ui;

use Magento\Framework\Api\FilterBuilder;

use Magento\Framework\View\Element\UiComponent\ContextInterface;

use Magento\Framework\View\Element\UiComponentInterface;

/**
 * Class Form
 */

class Form extends \Magento\Ui\Component\Form
{

    public function getDataSourceData()
    {
          #your code
    }

}
1
0

Did you try to rewrite it as a preference inside a di.xml?

<preference for="Magento\ConfigurableProduct\Ui\DataProvider\Product\Form\Modifier\ConfigurablePanel" type="Custom\Module\Some\Class" />

If you need more info about di.xml based dependancy injection http://devdocs.magento.com/guides/v2.1/extension-dev-guide/build/di-xml-file.html http://www.coolryan.com/magento/2016/01/22/preferences-in-magento-2/

Otherwise, please provide more information

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.