You are here

public function PathautoCommands::interactAliasTypes in Pathauto 8

@hook interact

File

src/Commands/PathautoCommands.php, line 186

Class

PathautoCommands
Drush commands allowing to perform Pathauto tasks from the command line.

Namespace

Drupal\pathauto\Commands

Code

public function interactAliasTypes(Input $input, Output $output) {
  if (!$input
    ->getArgument('types')) {
    $available_types = $this
      ->getAliasTypes();
    $question = new ChoiceQuestion(dt('Choose the alias type(s). Separate multiple choices with commas, e.g. "1,2,4", or choose "0" for all types.'), array_merge([
      static::TYPE_ALL,
    ], $available_types), NULL);
    $question
      ->setMultiselect(TRUE);
    $types = $this
      ->io()
      ->askQuestion($question);
    $input
      ->setArgument('types', implode(',', $types));
  }
}