src/Robo/Commands/Setup/ToggleModulesCommand.php
public function toggleModules() {
    if ($this->input()->hasArgument('environment')) {
      $environment = $this->input()->getArgument('environment');
    }
    elseif ($this->getConfig()->has('environment')) {
      $environment = $this->getConfigValue('environment');
    }
    elseif (!empty($_ENV['environment'])) {
      $environment = $_ENV['environment'];
    }

    if (isset($environment)) {
      // Enable modules.
      $enable_key = "modules.$environment.enable";
      $this->doToggleModules('pm-enable', $enable_key);

      // Uninstall modules.
      $disable_key = "modules.$environment.uninstall";
      $this->doToggleModules('pm-uninstall', $disable_key);
    }
    else {
      $this->say("Environment is unset. Skipping drupal:toggle:modules...");
    }
  }
public function toggleModules() {
    if ($this->input()->hasArgument('environment')) {
      $environment = $this->input()->getArgument('environment');
    }
    elseif ($this->getConfig()->has('environment')) {
      $environment = $this->getConfigValue('environment');
    }
    elseif (!empty($_ENV['environment'])) {
      $environment = $_ENV['environment'];
    }

    if (isset($environment)) {
      // Enable modules.
      $enable_key = "modules.$environment.enable";
      $this->doToggleModules('pm-enable', $enable_key);

      // Uninstall modules.
      $disable_key = "modules.$environment.uninstall";
      $this->doToggleModules('pm-uninstall', $disable_key);
    }
    else {
      $this->say("Environment is unset. Skipping drupal:toggle:modules...");
    }
  }
public function toggleModules ( ) { if ( $ this -> input ( ) -> hasArgument ( 'environment' ) ) { $ environment = $ this -> input ( ) -> getArgument ( 'environment' ) ; } elseif ( $ this -> getConfig ( ) -> has ( 'environment' ) ) { $ environment = $ this -> getConfigValue ( 'environment' ) ; } elseif ( ! empty ( $ _ENV [ 'environment' ] ) ) { $ environment = $ _ENV [ 'environment' ] ; } if ( isset ( $ environment ) ) { // Enable modules. $ enable_key = "modules.$environment.enable" ; $ this -> doToggleModules ( 'pm-enable' , $ enable_key ) ; // Uninstall modules. $ disable_key = "modules.$environment.uninstall" ; $ this -> doToggleModules ( 'pm-uninstall' , $ disable_key ) ; } else { $ this -> say ( "Environment is unset. Skipping drupal:toggle:modules..." ) ; } }
Enables and uninstalls specified modules.

You may define the environment for which modules should be toggled by
passing the --environment=[value] option to this command setting
$_ENV['environment'] via the CLI, or defining environment in one of your
BLT configuration files.

@command drupal:toggle:modules

@aliases dtm toggle setup:toggle-modules

@validateDrushConfig
@executeInVm
Enables and uninstalls specified modules .