You are here

public function ModuleHandler::invoke in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::invoke()

Invokes a hook in a particular module.

Parameters

string $module: The name of the module (without the .module extension).

string $hook: The name of the hook to invoke.

array $args: Arguments to pass to the hook implementation.

Return value

mixed The return value of the hook implementation.

Overrides ModuleHandlerInterface::invoke

1 call to ModuleHandler::invoke()
ModuleHandler::invokeDeprecated in core/lib/Drupal/Core/Extension/ModuleHandler.php
Invokes a deprecated hook in a particular module.

File

core/lib/Drupal/Core/Extension/ModuleHandler.php, line 387

Class

ModuleHandler
Class that manages modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

public function invoke($module, $hook, array $args = []) {
  if (!$this
    ->implementsHook($module, $hook)) {
    return;
  }
  $function = $module . '_' . $hook;
  return call_user_func_array($function, $args);
}