function HookCollectorPass::applyOrderOperations
Applies order operations to a hook implementation list.
Parameters
array<string, string> $implementation_list: Implementation list for one hook, as module names keyed by "$class::$method" identifiers.
list<\Drupal\Core\Hook\OrderOperation\OrderOperation> $order_operations: A list of order operations for one hook.
1 call to HookCollectorPass::applyOrderOperations()
- HookCollectorPass::calculateImplementations in core/
lib/ Drupal/ Core/ Hook/ HookCollectorPass.php - Calculates the ordered implementations.
File
-
core/
lib/ Drupal/ Core/ Hook/ HookCollectorPass.php, line 282
Class
- HookCollectorPass
- Collects and registers hook implementations.
Namespace
Drupal\Core\HookCode
protected static function applyOrderOperations(array &$implementation_list, array $order_operations) : void {
$module_finder = $implementation_list;
$identifiers = array_keys($module_finder);
foreach ($order_operations as $order_operation) {
$order_operation->apply($identifiers, $module_finder);
assert($identifiers === array_unique($identifiers));
assert(array_is_list($identifiers));
assert(!array_diff($identifiers, array_keys($module_finder)));
assert(!array_diff(array_keys($module_finder), $identifiers));
}
// Rebuild the identifier -> module array with the new order.
$identifiers = array_combine($identifiers, $identifiers);
$identifiers = array_intersect_key($identifiers, $module_finder);
$implementation_list = array_replace($identifiers, $module_finder);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.