function DevelHookCommand::askForImplementation

Prompts for an implementation when none was given.

Attributes

#[Interact]

File

src/Command/DevelHookCommand.php, line 45

Class

DevelHookCommand
Lists the implementations of a hook and opens one in an editor.

Namespace

Drupal\devel\Command

Code

public function askForImplementation(InputInterface $input, OutputInterface $output) : void {
  $hook = $input->getArgument('hook');
  if (!$hook || $input->getArgument('implementation')) {
    return;
  }
  if ($implementations = $this->getImplementations($hook)) {
    $io = new SymfonyStyle($input, $output);
    $choice = $io->choice((string) $this->t('Select the hook implementation you wish to view.'), array_keys($implementations));
    $input->setArgument('implementation', $choice);
  }
}