function HookCollectorPass::getOrderOperations

Gets order operations by hook.

Return value

array<string, list<\Drupal\Core\Hook\OrderOperation\OrderOperation>> Order operations by hook name.

2 calls to HookCollectorPass::getOrderOperations()
HookCollectorPass::calculateImplementations in core/lib/Drupal/Core/Hook/HookCollectorPass.php
Calculates the ordered implementations.
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 319

Class

HookCollectorPass
Collects and registers hook implementations.

Namespace

Drupal\Core\Hook

Code

protected function getOrderOperations() : array {
  $implementationsByHook = $this->getFilteredImplementations();
  $operations_by_hook = [];
  foreach ($this->orderOperations as $hook => $order_operations_by_weight) {
    ksort($order_operations_by_weight);
    $order_operations = array_merge(...$order_operations_by_weight);
    foreach ($order_operations as $key => $operation) {
      if (!isset($implementationsByHook[$hook][$operation->identify()])) {
        unset($order_operations[$key]);
      }
    }
    $operations_by_hook[$hook] = array_values($order_operations);
  }
  return $operations_by_hook;
}

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