function HookCollectorPass::collectAllHookImplementations
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Hook/HookCollectorPass.php \Drupal\Core\Hook\HookCollectorPass::collectAllHookImplementations()
Collects all hook implementations.
Parameters
\Symfony\Component\DependencyInjection\ContainerBuilder $container: The ContainerBuilder to get module parameters from.
Return value
static A HookCollectorPass instance holding all hook implementations and include file information.
1 call to HookCollectorPass::collectAllHookImplementations()
- HookCollectorPass::process in core/
lib/ Drupal/ Core/ Hook/ HookCollectorPass.php
File
-
core/
lib/ Drupal/ Core/ Hook/ HookCollectorPass.php, line 312
Class
- HookCollectorPass
- Collects and registers hook implementations.
Namespace
Drupal\Core\HookCode
protected static function collectAllHookImplementations(ContainerBuilder $container) : static {
$module_list = $container->getParameter('container.modules');
$parameters = $container->getParameterBag()
->all();
$skip_procedural_modules = array_filter(array_keys($module_list), static fn(string $module) => !empty($parameters["{$module}.skip_procedural_hook_scan"]));
$modules = array_keys($module_list);
$all_modules_preg = static::getModuleListPattern($modules);
$collector = new static($modules);
foreach ($module_list as $module => $info) {
$skip_procedural = in_array($module, $skip_procedural_modules);
$current_module_preg = static::getModuleListPattern([
$module,
]);
$collector->collectModuleHookImplementations(dirname($info['pathname']), $module, $current_module_preg, $all_modules_preg, $skip_procedural);
}
return $collector;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.