You are here

public function AccessResultNeutral::setReason in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Access/AccessResultNeutral.php \Drupal\Core\Access\AccessResultNeutral::setReason()
  2. 10 core/lib/Drupal/Core/Access/AccessResultNeutral.php \Drupal\Core\Access\AccessResultNeutral::setReason()

Sets the reason for this access result.

Parameters

$reason string|null: The reason of this access result or NULL if no reason is provided.

Return value

\Drupal\Core\Access\AccessResultInterface The access result instance.

Overrides AccessResultReasonInterface::setReason

File

core/lib/Drupal/Core/Access/AccessResultNeutral.php, line 44

Class

AccessResultNeutral
Value object indicating a neutral access result, with cacheability metadata.

Namespace

Drupal\Core\Access

Code

public function setReason($reason) {
  $this->reason = $reason;
  return $this;
}