function Hook::setMethod

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Hook/Attribute/Hook.php \Drupal\Core\Hook\Attribute\Hook::setMethod()

Set the method the hook should apply to.

Parameters

string $method: The method that the hook attribute applies to. This only needs to be set when the attribute is on the class.

File

core/lib/Drupal/Core/Hook/Attribute/Hook.php, line 51

Class

Hook
This class will not have an effect until Drupal 11.1.0.

Namespace

Drupal\Core\Hook\Attribute

Code

public function setMethod(string $method) : static {
    $this->method = $method;
    return $this;
}

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