function HookCollectorPass::collectIncludesPerHook
Collects include files by hook name.
Parameters
array<string, array<string, string>> $implementationsByHook: Implementations by hook.
array<string, list<string>> $groupIncludes: Explicitly defined group includes to filter out.
Return value
array<string, list<string>> Lists of include files by hook name.
1 call to HookCollectorPass::collectIncludesPerHook()
- HookCollectorPass::writeToContainer in core/
lib/ Drupal/ Core/ Hook/ HookCollectorPass.php - Writes collected definitions to the container builder.
File
-
core/
lib/ Drupal/ Core/ Hook/ HookCollectorPass.php, line 210
Class
- HookCollectorPass
- Collects and registers hook implementations.
Namespace
Drupal\Core\HookCode
protected function collectIncludesPerHook(array $implementationsByHook, array $groupIncludes) : array {
$includesMap = [];
foreach ($implementationsByHook as $hook => $hookImplementations) {
foreach ($hookImplementations as $identifier => $module) {
if (str_contains($identifier, '::')) {
continue;
}
$include = $this->includes[$identifier] ?? NULL;
if ($include !== NULL) {
// Do not add includes that are already in group includes.
if (isset($groupIncludes[$hook]) && in_array($include, $groupIncludes[$hook])) {
continue;
}
$includesMap[$hook][$include] = TRUE;
}
}
}
return array_map(array_keys(...), $includesMap);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.