function HookCollectorPass::collectAllHookImplementations
Collects all hook implementations.
@internal This method is only used by ModuleHandler.
@todo Pass only $container and make protected when ModuleHandler::add() is removed in Drupal 12.0.0.
Parameters
array<string, array{pathname: string}> $module_list: An associative array. Keys are the module names, values are relevant info yml file path.
list<string> $skipProceduralModules: Module names that are known to not have procedural hook implementations.
Return value
static A HookCollectorPass instance holding all hook implementations and include file information.
2 calls to HookCollectorPass::collectAllHookImplementations()
- HookCollectorPass::process in core/
lib/ Drupal/ Core/ Hook/ HookCollectorPass.php - ModuleHandler::add in core/
lib/ Drupal/ Core/ Extension/ ModuleHandler.php - Adds a module or profile to the list of currently active modules.
File
-
core/
lib/ Drupal/ Core/ Hook/ HookCollectorPass.php, line 395
Class
- HookCollectorPass
- Collects and registers hook implementations.
Namespace
Drupal\Core\HookCode
public static function collectAllHookImplementations(array $module_list, array $skipProceduralModules = []) : static {
$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, $skipProceduralModules);
$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.