function ThemeHookCollectorPass::writeToContainer

Writes collected definitions to the container builder.

Parameters

\Symfony\Component\DependencyInjection\ContainerBuilder $container: Container builder.

File

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

Class

ThemeHookCollectorPass
Collects and registers hook implementations.

Namespace

Drupal\Core\Hook

Code

protected function writeToContainer(ContainerBuilder $container) : void {
  $implementationsByHook = $this->calculateImplementations();
  static::registerHookServices($container, $implementationsByHook);
  // Write aggregated data about hooks into a temporary parameter.
  // We use a dot prefixed parameter so it will automatically get cleaned up.
  $container->setParameter('.theme_hook_data', [
    'theme_hook_list' => $this->sortByTheme($implementationsByHook),
    'theme_preprocess_for_suggestions' => $this->preprocessForSuggestions ?? [],
  ]);
}

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