class AccessResultForbidden
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Access/AccessResultForbidden.php \Drupal\Core\Access\AccessResultForbidden
- 10 core/lib/Drupal/Core/Access/AccessResultForbidden.php \Drupal\Core\Access\AccessResultForbidden
- 9 core/lib/Drupal/Core/Access/AccessResultForbidden.php \Drupal\Core\Access\AccessResultForbidden
- 8.9.x core/lib/Drupal/Core/Access/AccessResultForbidden.php \Drupal\Core\Access\AccessResultForbidden
Value object for a forbidden access result, with cacheability metadata.
Hierarchy
- class \Drupal\Core\Access\AccessResult implements \Drupal\Core\Access\AccessResultInterface, \Drupal\Core\Cache\RefinableCacheableDependencyInterface uses \Drupal\Core\Cache\RefinableCacheableDependencyTrait
- class \Drupal\Core\Access\AccessResultForbidden implements \Drupal\Core\Access\AccessResultReasonInterface extends \Drupal\Core\Access\AccessResult
Expanded class hierarchy of AccessResultForbidden
5 files declare their use of AccessResultForbidden
- AccessResultForbiddenTest.php in core/
tests/ Drupal/ Tests/ Core/ Access/ AccessResultForbiddenTest.php - BlockContentAccessHandlerTest.php in core/
modules/ block_content/ tests/ src/ Kernel/ BlockContentAccessHandlerTest.php - LatestRevisionCheckTest.php in core/
modules/ content_moderation/ tests/ src/ Unit/ LatestRevisionCheckTest.php - LocalActionManagerTest.php in core/
tests/ Drupal/ Tests/ Core/ Menu/ LocalActionManagerTest.php - StringFormatterTest.php in core/
modules/ field/ tests/ src/ Unit/ Plugin/ Field/ FieldFormatter/ StringFormatterTest.php
2 string references to 'AccessResultForbidden'
- RendererTest::testRenderWithAccessControllerResolved in core/
tests/ Drupal/ Tests/ Core/ Render/ RendererTest.php - Tests render with access controller resolved.
- TestAccessClass::trustedCallbacks in core/
tests/ Drupal/ Tests/ Core/ Render/ RendererTest.php
File
-
core/
lib/ Drupal/ Core/ Access/ AccessResultForbidden.php, line 8
Namespace
Drupal\Core\AccessView source
class AccessResultForbidden extends AccessResult implements AccessResultReasonInterface {
/**
* The reason why access is forbidden. For use in error messages.
*
* @var string
*/
protected $reason;
/**
* Constructs a new AccessResultForbidden 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 isForbidden() {
return TRUE;
}
/**
* {@inheritdoc}
*/
public function getReason() {
return (string) $this->reason;
}
/**
* {@inheritdoc}
*/
public function setReason($reason) {
$this->reason = $reason;
return $this;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.