function 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 127

Class

Hook
Attribute for defining a class method as a hook implementation.

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.