function DevelHookCommand::execute

File

src/Drush/Commands/DevelHookCommand.php, line 75

Class

DevelHookCommand
#[AsCommand(name: self::NAME, description: 'List implementations of a given hook and optionally edit one.', aliases: [ 'fnh', 'fn-hook', 'hook', 'devel-hook', ])] #[CLI\OptionsetGetEditor]

Namespace

Drupal\devel\Drush\Commands

Code

protected function execute(InputInterface $input, OutputInterface $output) : int {
  // Get implementations in the .install files as well.
  include_once DRUPAL_ROOT . '/core/includes/install.inc';
  drupal_load_updates();
  $info = $this->codeLocate($input->getArgument('implementation') . ('_' . $input->getArgument('hook')));
  $exec = self::getEditor('');
  $cmd = sprintf($exec, Escape::shellArg($info['file']));
  $process = $this->processManager
    ->shell($cmd);
  $process->setTty(TRUE);
  $process->mustRun();
  return Command::SUCCESS;
}