You are here

private function ModuleHandler::triggerDeprecationError in Drupal 8

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

Triggers an E_USER_DEPRECATED error if any module implements the hook.

Parameters

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

string $hook: The name of the hook.

2 calls to ModuleHandler::triggerDeprecationError()
ModuleHandler::invokeAllDeprecated in core/lib/Drupal/Core/Extension/ModuleHandler.php
Invokes a deprecated hook in all enabled modules that implement it.
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 441

Class

ModuleHandler
Class that manages modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

private function triggerDeprecationError($description, $hook) {
  $modules = array_keys($this
    ->getImplementationInfo($hook));
  if (!empty($modules)) {
    $message = 'The deprecated hook hook_' . $hook . '() is implemented in these functions: ';
    $implementations = array_map(function ($module) use ($hook) {
      return $module . '_' . $hook . '()';
    }, $modules);
    @trigger_error($message . implode(', ', $implementations) . '. ' . $description, E_USER_DEPRECATED);
  }
}