How can i override this path: vendor/magento/framework/View/Element/Html/Select.php

with my custom module file?

有帮助吗?

解决方案

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>

其他提示

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>
许可以下: CC-BY-SA归因
scroll top