You are here

class AccessResultNeutral in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Access/AccessResultNeutral.php \Drupal\Core\Access\AccessResultNeutral
  2. 9 core/lib/Drupal/Core/Access/AccessResultNeutral.php \Drupal\Core\Access\AccessResultNeutral

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

Hierarchy

Expanded class hierarchy of AccessResultNeutral

6 files declare their use of AccessResultNeutral
AccessResultNeutralTest.php in core/tests/Drupal/Tests/Core/Access/AccessResultNeutralTest.php
AccessResultTest.php in core/tests/Drupal/Tests/Core/Access/AccessResultTest.php
Contains \Drupal\Tests\Core\Access\AccessResultTest.
BlockPluginHasSettingsTrayFormAccessCheckTest.php in core/modules/settings_tray/tests/src/Unit/Access/BlockPluginHasSettingsTrayFormAccessCheckTest.php
book_breadcrumb_test.module in core/modules/book/tests/modules/book_breadcrumb_test/book_breadcrumb_test.module
Test module for testing the book module breadcrumb.
LatestRevisionCheckTest.php in core/modules/content_moderation/tests/src/Unit/LatestRevisionCheckTest.php

... See full list

File

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

Namespace

Drupal\Core\Access
View source
class AccessResultNeutral extends AccessResult implements AccessResultReasonInterface {

  /**
   * The reason why access is neutral. For use in messages.
   *
   * @var string
   */
  protected $reason;

  /**
   * Constructs a new AccessResultNeutral instance.
   *
   * @param null|string $reason
   *   (optional) A message to provide details about this access result
   */
  public function __construct($reason = NULL) {
    $this->reason = $reason;
  }

  /**
   * {@inheritdoc}
   */
  public function isNeutral() {
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function getReason() {
    return (string) $this->reason;
  }

  /**
   * {@inheritdoc}
   */
  public function setReason($reason) {
    $this->reason = $reason;
    return $this;
  }

}

Members