You are here

public function ModuleHandler::invokeDeprecated in Drupal 8

Same name and namespace in other branches
  1. 9 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

See also

\Drupal\Core\Extension\ModuleHandlerInterface::invoke()

https://www.drupal.org/core/deprecation#how-hook

File

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

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;
}