function ModuleHandler::triggerDeprecationError

Same name in other branches
  1. 9 core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::triggerDeprecationError()
  2. 8.9.x core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::triggerDeprecationError()
  3. 11.x 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
ModuleHandler::invokeDeprecated in core/lib/Drupal/Core/Extension/ModuleHandler.php

File

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

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

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