function RulesCommands::interactDisabledRules

@hook interact @interact-disabled-rules

File

src/Commands/RulesCommands.php, line 448

Class

RulesCommands
Drush 9+ commands for the Rules module.

Namespace

Drupal\rules\Commands

Code

public function interactDisabledRules($input, $output) {
  if (empty($input->getArgument('rule'))) {
    $rules = $this->configFactory
      ->listAll('rules.reaction');
    // Loop over configuration entities for this $item.
    foreach ($rules as $index => $config) {
      $rule = $this->configFactory
        ->get($config);
      if ($rule->get('status') === TRUE) {
        unset($rules[$index]);
      }
    }
    $choice = $this->io()
      ->choice('Choose a Reaction Rule', drush_map_assoc($rules));
    $input->setArgument('rule', $choice);
  }
}