function DevelCommands::hookInteract
Same name in this branch
- 5.x src/Commands/DevelCommands.php \Drupal\devel\Commands\DevelCommands::hookInteract()
Same name in other branches
- 4.x src/Commands/DevelCommands.php \Drupal\devel\Commands\DevelCommands::hookInteract()
Asks the user to select a hook implementation.
File
-
src/
Drush/ Commands/ DevelCommands.php, line 134
Class
Namespace
Drupal\devel\Drush\CommandsCode
public function hookInteract(Input $input, Output $output) : void {
$hook_implementations = [];
if (!$input->getArgument('implementation')) {
foreach (array_keys($this->moduleHandler
->getModuleList()) as $key) {
if ($this->moduleHandler
->hasImplementations($input->getArgument('hook'), [
$key,
])) {
$hook_implementations[] = $key;
}
}
if ($hook_implementations !== []) {
if (!($choice = $this->io()
->select('Enter the number of the hook implementation you wish to view.', array_combine($hook_implementations, $hook_implementations)))) {
throw new UserAbortException();
}
$input->setArgument('implementation', $choice);
}
else {
throw new \Exception(dt('No implementations'));
}
}
}