function HookCollectorPass::getFilteredImplementations

Gets implementation lists with removals already applied.

Return value

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

2 calls to HookCollectorPass::getFilteredImplementations()
HookCollectorPass::calculateImplementations in core/lib/Drupal/Core/Hook/HookCollectorPass.php
Calculates the ordered implementations.
HookCollectorPass::getImplementations in core/lib/Drupal/Core/Hook/HookCollectorPass.php
This method is only to be used by ModuleHandler.

File

core/lib/Drupal/Core/Hook/HookCollectorPass.php, line 191

Class

HookCollectorPass
Collects and registers hook implementations.

Namespace

Drupal\Core\Hook

Code

protected function getFilteredImplementations() : array {
  $implementationsByHook = [];
  foreach ($this->proceduralImplementations as $hook => $procedural_modules) {
    foreach ($procedural_modules as $module) {
      $implementationsByHook[$hook][ProceduralCall::class . '::' . $module . '_' . $hook] = $module;
    }
  }
  foreach ($this->oopImplementations as $hook => $oopImplementations) {
    if (!isset($implementationsByHook[$hook])) {
      $implementationsByHook[$hook] = $oopImplementations;
    }
    else {
      $implementationsByHook[$hook] += $oopImplementations;
    }
  }
  foreach ($this->removeHookIdentifiers as $hook => $identifiers_to_remove) {
    foreach ($identifiers_to_remove as $identifier_to_remove) {
      unset($implementationsByHook[$hook][$identifier_to_remove]);
    }
    if (empty($implementationsByHook[$hook])) {
      unset($implementationsByHook[$hook]);
    }
  }
  return $implementationsByHook;
}

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