3

In magento 1.X we can check my exention is enabled or not in xml via below kind of code.

<action method="removeItem" ifconfig="easylife_switcher/settings/enabled">
      <type>skin_js</type>
      <name>js/configurableswatches/product-media.js</name>
</action>

is there any way in magento 2.0 so that I can check my extension is enabled or not from config.

I was override Magento_Checkout/js/model/shipping-service.js in my custom module using require-config.js. At one point i was face issue on disabling my custom module.

var config = {
map: {
    '*': {
        'Magento_Checkout/js/model/shipping-service' :
              '{namespace}_{modulename}/js/model/shipping-service'
    }
}};

After disabling my custom module i want to call core shipping-service.js instead of mine overridden.

1

Check enable or disable from admin config - ifconfig

We can do the same way as Magento 1: vendor/magento/module-wishlist/view/frontend/layout/customer_account.xml

        <block class="Magento\Framework\View\Element\Html\Link\Current" ifconfig="wishlist/general/active" name="customer-account-navigation-wish-list-link">
            <arguments>
                <argument name="path" xsi:type="string">wishlist</argument>
                <argument name="label" xsi:type="string">My Wish List</argument>
            </arguments>
        </block>

Disabling Js custom module

We should disable module via command line: magento module:disable Yourcustom_Module.

Overridden Js files will be loaded via Require Js under pub/static/_requirejs. So we need to delete this file. This file will be generated automatically again. However, your overridden js will not be added again after disabling module.

1
  • 1
    Yes, its true. but i want to disable from config. Is there any way to disable js from config? or can i write condition in require-config, if yes. then how? Oct 17 '16 at 4:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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