function RulesCommands::interactRuleNames

@hook interact @interact-rule-names

File

src/Commands/RulesCommands.php, line 466

Class

RulesCommands
Drush 9+ commands for the Rules module.

Namespace

Drupal\rules\Commands

Code

public function interactRuleNames($input, $output) {
    if (empty($input->getArgument('rule'))) {
        $rule_names = $this->configFactory
            ->listAll('rules.reaction');
        $component_names = $this->configFactory
            ->listAll('rules.component');
        $config_names = array_merge($rule_names, $component_names);
        $choice = $this->io()
            ->choice('Choose a Rule', drush_map_assoc($config_names));
        $input->setArgument('rule', $choice);
    }
}