class ReorderHook

Sets the order of an already existing implementation.

The effect of this attribute is independent from the specific class or method on which it is placed.

Attributes

#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

Hierarchy

Expanded class hierarchy of ReorderHook

4 files declare their use of ReorderHook
DHooks.php in core/modules/system/tests/modules/HookOrder/ddd_hook_order_test/src/Hook/DHooks.php
EntityOperations.php in core/modules/workspaces/src/Hook/EntityOperations.php
HookCollectorPass.php in core/lib/Drupal/Core/Hook/HookCollectorPass.php
TestHookReorderHookFirst.php in core/modules/system/tests/modules/HookCollector/aaa_hook_collector_test/src/Hook/TestHookReorderHookFirst.php

File

core/lib/Drupal/Core/Hook/Attribute/ReorderHook.php, line 15

Namespace

Drupal\Core\Hook\Attribute
View source
class ReorderHook implements HookAttributeInterface {
  
  /**
   * Constructs a ReorderHook object.
   *
   * @param string $hook
   *   The hook for which to reorder an implementation.
   * @param class-string $class
   *   The class of the targeted hook implementation.
   * @param string $method
   *   The method name of the targeted hook implementation.
   *   If the #[Hook] attribute is on the class itself, this should be
   *   '__invoke'.
   * @param \Drupal\Core\Hook\Order\OrderInterface $order
   *   Specifies a new position for the targeted hook implementation relative to
   *   other implementations.
   */
  public function __construct(public string $hook, public string $class, public string $method, public OrderInterface $order) {
  }

}

Members

Title Sort descending Modifiers Object type Summary
ReorderHook::__construct public function Constructs a ReorderHook object.

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