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

with my custom module file?

  • Can you please look at the question clearly. @Prince Patel – Learing_Coder Sep 1 '17 at 12:33
  • Check this answer: magento.stackexchange.com/a/154517/35758 – Prince Patel Sep 1 '17 at 12:36
  • It is not block file override @Prince Patel it is vendor/magento/framework/View/Element/Html/Select.php to override in my custom module – Learing_Coder Sep 1 '17 at 12:43
  • 1
    Select.php extends \Magento\Framework\View\Element\AbstractBlock itself is a block. Have you tried my answer? – Prince Patel Sep 1 '17 at 13:22


<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" />

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" />
  • can you just brief these terms Your_Class_Type\Your_Class i cannot get you @Nikolas – Learing_Coder Sep 1 '17 at 12:29
  • Please Can you reply soon @Nikloas – Learing_Coder Sep 1 '17 at 12:42
  • Is the path to your class that will override the one you requested. Your_class_type can be the Model folder for example and the Your_Class the class name. – Nikolas Sep 1 '17 at 13:00

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