Disable module output

By default, all modules are configured so that a module’s output can be written to a view. Turning off output offers a way to essentially disable a module that can’t be disabled due to hard dependencies. For example, the Customer module depends on the Review module, so the Review module can’t be disabled. However, if you don’t want customers to be able to provide reviews, you could turn off output from the Review module.

If a merchant used the Admin to disable a module’s output in a previous release, you must manually configure the system to migrate these settings.

Disable module output in a pipeline deployment

Use the following steps to disable module output in pipeline or any other deployment with multiple instances of Magento.

  1. Edit the Backend module’s config.xml file.
  2. Export the configuration changes.

Edit the Backend module’s config.xml file

Archive the original config.xml file. Then add lines similar to the following to the <Magento_install_dir>/vendor/magento/module-backend/etc/config.xml file directly under the <default> element:

<advanced>
    <modules_disable_output>
        <Magento_Newsletter>1</Magento_Newsletter>
    </modules_disable_output>
</advanced>

where

  • <modules_disable_output> contains a list of modules.
  • <Magento_Newsletter></Magento_Newsletter> specifies which module to disable output.
  • 1 is the flag that disables output for the Magento_Newsletter module.

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:

magento app:config:dump

The results are written to the <Magento_install_dir>/app/etc/config.php file.

For more information about this command, see Export the configuration.

Disable module output in a simple deployment

The procedure for disabling module output on a single instance of Magento is easier because the changes don’t have to be distributed.

Archive the original <Magento_install_dir>/app/etc/config.php file. Then add the advanced and modules_disable_output sections to the config.php file (if they don’t already exist), as shown below:

'advanced' =>
array (
  'modules_disable_output' =>
  array (
    'Magento_Newsletter' => '1',
  ),
)

where the array beneath modules_disable_output contains a list of modules. A value of 1 disables output for that module.

As a sample result of this configuration, customers can no longer sign up to receive newsletters.