function RelativeOrderBase::getOperation

Gets order operations specified by this object.

Parameters

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 value

\Drupal\Core\Hook\OrderOperation\OrderOperation Order operation to apply to a hook implementation list.

Overrides OrderInterface::getOperation

File

core/lib/Drupal/Core/Hook/Order/RelativeOrderBase.php, line 45

Class

RelativeOrderBase
Orders an implementation relative to other implementations.

Namespace

Drupal\Core\Hook\Order

Code

public function getOperation(string $identifier) : OrderOperation {
  return new BeforeOrAfter($identifier, $this->modules, array_map(static function (array $class_and_method) : string {
    if ($class_and_method[0] === ProceduralCall::class) {
      return $class_and_method[1];
    }
    else {
      return $class_and_method[0] . '::' . $class_and_method[1];
    }
  }, $this->classesAndMethods), $this->isAfter());
}

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