Disable module output
- Topics:
- Configuration
CREATED FOR:
- Experienced
- Admin
- Developer
By default, all modules are configured so that module output can be written to a view. Turning off output offers a way to essentially disable a module that cannot be disabled due to hard dependencies.
For example, the Customer module depends on the Review module, so the Review module cannot be disabled. However, if you do not want customers to provide reviews, you could turn off output from the Review module.
The Output disabling is performed in following classes:
Disable module output in a pipeline deployment
To disable module output in the pipeline deployment or any other deployment, with multiple instances of the Commerce application:
- Edit the
Backendmodule’sconfig.xmlfile. - Export the configuration changes.
Edit the Backend module config.xml file
-
Archive the original
config.xmlfile. -
Add lines similar to the following to the
<Magento_install_dir>/vendor/magento/module-backend/etc/config.xmlfile, directly under the<default>element:<advanced> <modules_disable_output> <Magento_Newsletter>1</Magento_Newsletter> </modules_disable_output> </advanced>Here:
<modules_disable_output>contains a list of modules.<Magento_Newsletter></Magento_Newsletter>specifies which module to disable output for.1is the flag that disables output for theMagento_Newslettermodule.
As a sample result of this configuration, customers can no longer sign up to receive newsletters.
Export the configuration changes
Run the following command to export the configuration changes:
bin/magento app:config:dump
The results are written to the <Magento_install_dir>/app/etc/config.php file.
Next, clear the cache to enable the new setting:
bin/magento cache:clean config
Disable module output in a simple deployment
The procedure for disabling module output on a single instance of Commerce is easier because the changes do not have to be distributed.
-
Archive the original
<Magento_install_dir>/app/etc/config.phpfile. -
Add the
advancedandmodules_disable_outputsections to theconfig.phpfile (if they do not exist):'system' => array ( 'websites' => array ( 'base' => array ( 'advanced' => array ( 'modules_disable_output' => array ( 'Magento_Review' => '1', ), ), ), ), ),
In this example, output for the Magento_Review module has been disabled and customers can no longer review products.
Re-enable module output
To re-enable output, set the value for the module to 0, or remove the line/module from the config.php file.