function ThemeHookCollectorPass::collectAllHookImplementations

Collects all hook implementations.

@internal

Parameters

\Symfony\Component\DependencyInjection\ContainerBuilder $container: The container.

Return value

static A ThemeHookCollectorPass instance holding all hook implementations and include file information.

1 call to ThemeHookCollectorPass::collectAllHookImplementations()
ThemeHookCollectorPass::process in core/lib/Drupal/Core/Hook/ThemeHookCollectorPass.php

File

core/lib/Drupal/Core/Hook/ThemeHookCollectorPass.php, line 151

Class

ThemeHookCollectorPass
Collects and registers hook implementations.

Namespace

Drupal\Core\Hook

Code

protected static function collectAllHookImplementations(ContainerBuilder $container) : static {
  $parameters = $container->getParameterBag()
    ->all();
  $themeList = $parameters['container.themes'];
  $skipProcedural = array_filter(array_keys($themeList), static fn(string $theme) => !empty($parameters["{$theme}.skip_procedural_hook_scan"]));
  $themes = array_keys($themeList);
  $allThemesPreg = static::getThemeListPattern($themes);
  $collector = new static($themes);
  foreach ($themeList as $theme => $info) {
    $shouldSkipProceduralScan = in_array($theme, $skipProcedural);
    $currentThemePreg = static::getThemeListPattern([
      $theme,
    ]);
    $collector->collectThemeHookImplementations(dirname($info['pathname']), $theme, $currentThemePreg, $allThemesPreg, $shouldSkipProceduralScan);
  }
  return $collector;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.