How can I override the Vendor with Custom module in magento 2 [duplicate]
-
11-12-2020 - |
Question
How can i override this path:
vendor/magento/framework/View/Element/Html/Select.php
with my custom module file?
Solution
Your_VendorName\Your_ModuleName\etc\di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Framework\View\Element\Html\Select" type="Your_VendorName\Your_ModuleName\Model\Framework\View\Element\Html\Select" />
</config>
OTHER TIPS
Try overriding the class using a preference in your di.xml
file like
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Framework\View\Element\Html\Select" type="Your_Vendor\Your_Module\Your_Class_Type\Your_Class" />
</config>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange