interface OrderInterface

Interface for order specifiers used in hook attributes.

Objects implementing this interface allow for relative ordering of hooks. These objects are passed as an order parameter to a Hook or ReorderHook attribute. Order::First and Order::Last are simple order operations that move the hook implementation to the first or last position of hooks at the time the order directive is executed.


  #[Hook('custom_hook', order: Order::First)]
  

OrderBefore and OrderAfter take additional parameters for ordering. See Drupal\Core\Hook\Order\RelativeOrderBase.


  #[Hook('custom_hook', order: new OrderBefore(['other_module']))]
  

Hierarchy

Expanded class hierarchy of OrderInterface

All classes that implement OrderInterface

2 files declare their use of OrderInterface
Hook.php in core/lib/Drupal/Core/Hook/Attribute/Hook.php
ReorderHook.php in core/lib/Drupal/Core/Hook/Attribute/ReorderHook.php

File

core/lib/Drupal/Core/Hook/Order/OrderInterface.php, line 27

Namespace

Drupal\Core\Hook\Order
View source
interface OrderInterface {
    
    /**
     * Gets order operations specified by this object.
     *
     * @param string $identifier
     *   Identifier of the implementation to move to a new position. The format
     *   is the class followed by "::" then the method name. For example,
     *   "Drupal\my_module\Hook\MyModuleHooks::methodName".
     *
     * @return \Drupal\Core\Hook\OrderOperation\OrderOperation
     *   Order operation to apply to a hook implementation list.
     */
    public function getOperation(string $identifier) : OrderOperation;

}

Members

Title Sort descending Modifiers Object type Summary Overrides
OrderInterface::getOperation public function Gets order operations specified by this object. 1

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