function RulesCommands::interactEnabledRules

@hook interact @interact-enabled-rules

File

src/Commands/RulesCommands.php, line 430

Class

RulesCommands
Drush 9+ commands for the Rules module.

Namespace

Drupal\rules\Commands

Code

public function interactEnabledRules($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') === FALSE) {
                unset($rules[$index]);
            }
        }
        $choice = $this->io()
            ->choice('Choose a Reaction Rule', drush_map_assoc($rules));
        $input->setArgument('rule', $choice);
    }
}