4

I have a frontend theme that is being loaded through an module, so that im not able to do any changes to it when it comes to enabling and disabling other modules as you usually do in different store views. So what i have been wondering is whether or not it is possible to disable / skip some modules when that frontend theme is being used?

I know it is possible on Magento 1.9 with command like this in theme.xml:

<config>
    <modules>
        <[Your_Module_Name]>
            <active>false</active>
        </[Your_Module_Name]>
    </modules>
</config>

However i dont know how to do it in Magento 2, and i cannot seem to find any information on it..

Stian

2

As of 2.1 this is not possible it's not possible and I highly doubt it'll be possible in the future.

In Magento 1, the status of an extension was stored in an xml file under app/etc/modules. Basically, when the app was started, the system was merging all the XML files to generate a big configuration file.

Thanks to this system, you were able to disable an extension for a specific theme.

However, in Magento 2, the module status are no longer stored in XML but in a PHP file app/etc/config.php. Thus, apart if you develop your own custom module this is not possible out of the box in Magento 2.

2

After the comments from @belfort1 and @Raphael at Digital Pianism i understand that it is not possible to do this the way i think.

Using commands like

<referenceBlock name="custom.module.block" remove="true"  />

is one way to do it, but this causing issues like that changes to other blocks thats being done by that module will still be done...

The best possible solution ive found till now would be to use override command and remove complete content of module/extensions layout files for frontend on that theme.

<theme_dir>/<Namespace_Module>/layout/override/base/<layout>.xml

Guide for this could be found on Magento`s Devdocs: http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/layout-override.html

0

if the specific design is assigned to a store view...maybe you can try to disable modules output in the backend for that store view under Stores-> Configuration -> Advanced

  • The design isnt assigned to any store views.. – Stian Blåsberg Sep 11 '16 at 14:30
-2

Using the command line, in root folder of your project, type:

php bin/magento module:disable Package_Module 

You can see list of all commands by typing php bin/magento

Update:

For disabling output in frontend you could create in your theme folder:

frontend/MyPackage/my-theme/CustomModule/default.xml

Default could also match the specific name of xml file you are trying to modify, here you could use the remove method for unsetting blocks or containers from custom module, ie:

<referenceBlock name="custom.module.block" remove="true"  />
  • This doesn't answer OP's question, as their question specifically states that they are looking for a way to do this with theme.xml. – tjons Sep 11 '16 at 11:54
  • Please read the question again. I need to do this only for a specific design, not the entire installation.. – Stian Blåsberg Sep 11 '16 at 11:55
  • So which module are you looking to skip in frontend? – belfort1 Sep 11 '16 at 15:29
  • @belfort1 it does not really matter which module im looking to skip/disable. It is some custom modules, that is not needed on that design. – Stian Blåsberg Sep 11 '16 at 16:33
  • 1
    updated my answer. – belfort1 Sep 12 '16 at 7:06

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.