1

I'm trying to override lib/web/mage/adminhtml/browser.js in my module.

here is my Company/CampaignPopup/view/frontend/requirejs-config.js

var config = {
map: {
    "*": {

        'browser':'Company_CampaignPopup/js/adminhtml/browser-custom',
        'adminhtml/browser':'Company_CampaignPopup/js/adminhtml/browser-custom',
        'mage/adminhtml/browser': 'Company_CampaignPopup/js/adminhtml/browser-custom'
         }
     }
};

I was trying all this paths.

1
  • Did you find any solution?
    – ND17
    Jul 18, 2017 at 7:46

1 Answer 1

1

Try following code:

  1. app/code/[VendorName]/[ModuleName]/registration.php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    '[VendorName]_[ModuleName]',
    __DIR__
);
  1. app/code/[VendorName]/[ModuleName]/etc/module.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="[VendorName]_[ModuleName]" setup_version="1.0.0">
        <sequence>
            <module name="Magento_Theme"/>
        </sequence>
    </module>
</config>
  1. app/code/[VendorName]/[ModuleName]/etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Theme\Model\View\Design">
        <arguments>
            <argument name="themes" xsi:type="array">
                <item name="adminhtml" xsi:type="string">[VendorName]/[themename]</item>
            </argument>
        </arguments>
    </type>
</config>
  1. app/design/adminhtml/[VendorName]/[themename]/registration.php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'adminhtml/[VendorName]/[themename]',
    __DIR__
);
  1. app/design/adminhtml/[VendorName]/[themename]/theme.xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>Theme Title</title>
    <parent>Magento/backend</parent>
</theme>
  1. app/design/adminhtml/[VendorName]/[themename]/requirejs-config.js
var config = {
    map: {
        '*': {
            'mage/adminhtml/browser':'mage/adminhtml/custom-browser'
        }
    }
};
  1. app/design/adminhtml/[VendorName]/[themename]/web/mage/adminhtml/custom-browser.js
1
  • Doesn't look like to work on Magento 2.4.2. Got static compilation error. Mar 17, 2021 at 15:45

Your Answer

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

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