You are here

function DevelCommands::hook in Devel 8.2

Same name and namespace in other branches
  1. 8.3 src/Commands/DevelCommands.php \Drupal\devel\Commands\DevelCommands::hook()
  2. 8 src/Commands/DevelCommands.php \Drupal\devel\Commands\DevelCommands::hook()
  3. 4.x src/Commands/DevelCommands.php \Drupal\devel\Commands\DevelCommands::hook()

List implementations of a given hook and optionally edit one.

@command devel:hook

@usage devel-hook cron List implementations of hook_cron(). @aliases fnh,fn-hook,hook,devel-hook @optionset_get_editor

Parameters

$hook The name of the hook to explore.:

$implementation The name of the implementation to edit. Usually omitted.:

File

src/Commands/DevelCommands.php, line 92

Class

DevelCommands
For commands that are parts of modules, Drush expects to find commandfiles in __MODULE__/src/Commands, and the namespace is Drupal/__MODULE__/Commands.

Namespace

Drupal\devel\Commands

Code

function hook($hook, $implementation) {

  // Get implementations in the .install files as well.
  include_once './core/includes/install.inc';
  drupal_load_updates();
  $info = $this
    ->codeLocate($implementation . "_{$hook}");
  $exec = drush_get_editor();
  drush_shell_exec_interactive($exec, $info['file']);
}