function DevelCommands::hook

Same name in this branch
  1. 5.x src/Commands/DevelCommands.php \Drupal\devel\Commands\DevelCommands::hook()
Same name in other branches
  1. 4.x src/Commands/DevelCommands.php \Drupal\devel\Commands\DevelCommands::hook()

List implementations of a given hook and optionally edit one.

File

src/Drush/Commands/DevelCommands.php, line 114

Class

DevelCommands

Namespace

Drupal\devel\Drush\Commands

Code

public function hook(string $hook, string $implementation) : void {
    // Get implementations in the .install files as well.
    include_once DRUPAL_ROOT . '/core/includes/install.inc';
    drupal_load_updates();
    $info = $this->codeLocate($implementation . ('_' . $hook));
    $exec = self::getEditor('');
    $cmd = sprintf($exec, Escape::shellArg($info['file']));
    $process = $this->processManager()
        ->shell($cmd);
    $process->setTty(TRUE);
    $process->mustRun();
}