function ThemeHookCollectorPass::calculateImplementations

Calculates the ordered implementations.

Return value

array<string, array<string, string>> Implementations, as theme names keyed by hook name and "$class::$method" identifier.

1 call to ThemeHookCollectorPass::calculateImplementations()
ThemeHookCollectorPass::writeToContainer in core/lib/Drupal/Core/Hook/ThemeHookCollectorPass.php
Writes collected definitions to the container builder.

File

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

Class

ThemeHookCollectorPass
Collects and registers hook implementations.

Namespace

Drupal\Core\Hook

Code

protected function calculateImplementations() : array {
  $implementationsByHookOrig = $this->getFilteredImplementations();
  // Store preprocess implementations for themes.
  foreach ($implementationsByHookOrig as $hook => $hookImplementations) {
    if (is_string($hook) && str_starts_with($hook, 'preprocess_') && str_contains($hook, '__')) {
      foreach ($hookImplementations as $theme) {
        $this->preprocessForSuggestions[$theme . '_' . $hook] = TRUE;
      }
    }
  }
  return $implementationsByHookOrig;
}

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