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. 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
ModuleHandler::invokeDeprecated in core/lib/Drupal/Core/Extension/ModuleHandler.php

File

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

Class

ModuleHandler
Class that manages modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

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

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