function HookCollectorPass::addFromAttribute
Adds a Hook attribute implementation.
Parameters
\Drupal\Core\Hook\Attribute\Hook $hook: A hook attribute.
$class: The class in which said attribute resides in.
$module: The module in which the class resides in.
Return value
void
2 calls to HookCollectorPass::addFromAttribute()
- HookCollectorPass::collectModuleHookImplementations in core/
lib/ Drupal/ Core/ Hook/ HookCollectorPass.php - Collects procedural and Attribute hook implementations.
- HookCollectorPass::convertProceduralToImplementations in core/
lib/ Drupal/ Core/ Hook/ HookCollectorPass.php - Converts procedural hooks to attribute based hooks.
File
-
core/
lib/ Drupal/ Core/ Hook/ HookCollectorPass.php, line 274
Class
- HookCollectorPass
- Collects and registers hook implementations.
Namespace
Drupal\Core\HookCode
protected function addFromAttribute(Hook $hook, $class, $module) {
$this->implementations[$hook->hook][$class][$hook->method] = [
'priority' => $hook->priority ?? $this->priority--,
'module' => $hook->module ?? $module,
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.