function ModuleHandler::invokeDeprecated

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

Invokes a deprecated hook in a particular module.

Invoking a deprecated hook adds the behavior of triggering an E_USER_DEPRECATED error if any implementations are found.

API maintainers should use this method instead of invoke() when their hook is deprecated. This method does not detect when a hook is deprecated.

Parameters

string $description: Helpful text describing what to do instead of implementing this hook.

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::invokeDeprecated

File

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

Class

ModuleHandler
Class that manages modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

public function invokeDeprecated($description, $module, $hook, array $args = []) {
    $result = $this->invoke($module, $hook, $args);
    $this->triggerDeprecationError($description, $hook);
    return $result;
}

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