function HookOrder::after

Set a hook implementation to fire after others.

This method tries to keep existing order as much as possible. For example, if there are five hook implementations, A, B, C, D, E firing in this order then moving B after D will set it before E.

Parameters

\Drupal\Core\DependencyInjection\ContainerBuilder $container: The container builder.

string $hook: The name of the hook.

string $class_and_method: Class and method separated by :: containing the hook implementation which should be changed.

string ...$others: A list specifying the other implementations this hook should fire before. Every list member is a class and method separated by ::.

Return value

void

3 calls to HookOrder::after()
HookOrderEqualPriorityTest::testAfter in core/tests/Drupal/Tests/Core/Hook/HookOrderEqualPriorityTest.php
@covers ::after
HookOrderTest::testAfter in core/tests/Drupal/Tests/Core/Hook/HookOrderTest.php
@covers ::after
HookOrderTest::testAfterNoChange in core/tests/Drupal/Tests/Core/Hook/HookOrderTest.php
@covers ::after

File

core/lib/Drupal/Core/Hook/HookOrder.php, line 90

Class

HookOrder
Helper methods to set priorities of hook implementations.

Namespace

Drupal\Core\Hook

Code

public static function after(ContainerBuilder $container, string $hook, string $class_and_method, string ...$others) : void {
    self::changePriority($container, $hook, $class_and_method, FALSE, array_flip($others));
}

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