function HookCollectorPass::addProceduralImplementation
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Hook/HookCollectorPass.php \Drupal\Core\Hook\HookCollectorPass::addProceduralImplementation()
Adds a procedural hook implementation.
Parameters
\SplFileInfo $fileinfo: The file this procedural implementation is in.
string $hook: The name of the hook.
string $module: The module implementing the hook, or on behalf of which the hook is implemented.
1 call to HookCollectorPass::addProceduralImplementation()
- HookCollectorPass::collectModuleHookImplementations in core/
lib/ Drupal/ Core/ Hook/ HookCollectorPass.php - Collects procedural and Attribute hook implementations.
File
-
core/
lib/ Drupal/ Core/ Hook/ HookCollectorPass.php, line 529
Class
- HookCollectorPass
- Collects and registers hook implementations.
Namespace
Drupal\Core\HookCode
protected function addProceduralImplementation(\SplFileInfo $fileinfo, string $hook, string $module) : void {
$function = $module . '_' . $hook;
if ($hook === 'module_implements_alter') {
$message = "{$function} without a #[LegacyModuleImplementsAlter] attribute is deprecated in drupal:11.2.0 and removed in drupal:12.0.0. See https://www.drupal.org/node/3496788";
@trigger_error($message, E_USER_DEPRECATED);
$this->moduleImplementsAlters[] = $function;
include_once $fileinfo->getPathname();
}
elseif (in_array($hook, [
'requirements',
'requirements_alter',
])) {
$message = "{$function} without a #[LegacyRequirementsHook] attribute is deprecated in drupal:11.3.0 and removed in drupal:13.0.0. See https://www.drupal.org/node/3549685";
@trigger_error($message, E_USER_DEPRECATED);
}
$this->proceduralImplementations[$hook][] = $module;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.