function ModuleHandler::invoke

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::invoke()
  2. 10 core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::invoke()
  3. 11.x core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::invoke()

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 412

Class

ModuleHandler
Class that manages modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

public function invoke($module, $hook, array $args = []) {
    if (!$this->hasImplementations($hook, $module)) {
        return;
    }
    $hookInvoker = \Closure::fromCallable($module . '_' . $hook);
    return call_user_func_array($hookInvoker, $args);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.