interface AccessResultReasonInterface
Same name in other branches
- 9 core/lib/Drupal/Core/Access/AccessResultReasonInterface.php \Drupal\Core\Access\AccessResultReasonInterface
- 8.9.x core/lib/Drupal/Core/Access/AccessResultReasonInterface.php \Drupal\Core\Access\AccessResultReasonInterface
- 11.x core/lib/Drupal/Core/Access/AccessResultReasonInterface.php \Drupal\Core\Access\AccessResultReasonInterface
Interface for access result value objects with stored reason for developers.
For example, a developer can specify the reason for forbidden access:
new AccessResultForbidden('You are not authorized to hack core');
Hierarchy
- interface \Drupal\Core\Access\AccessResultInterface
- interface \Drupal\Core\Access\AccessResultReasonInterface extends \Drupal\Core\Access\AccessResultInterface
Expanded class hierarchy of AccessResultReasonInterface
All classes that implement AccessResultReasonInterface
See also
\Drupal\Core\Access\AccessResultInterface
15 files declare their use of AccessResultReasonInterface
- AccessAwareRouter.php in core/
lib/ Drupal/ Core/ Routing/ AccessAwareRouter.php - AccessResultTest.php in core/
tests/ Drupal/ Tests/ Core/ Access/ AccessResultTest.php - BlockContentAccessHandlerTest.php in core/
modules/ block_content/ tests/ src/ Kernel/ BlockContentAccessHandlerTest.php - config_test_rest.module in core/
modules/ rest/ tests/ modules/ config_test_rest/ config_test_rest.module - Contains hook implementations for testing REST module.
- EntityAccessChecker.php in core/
modules/ jsonapi/ src/ Access/ EntityAccessChecker.php
File
-
core/
lib/ Drupal/ Core/ Access/ AccessResultReasonInterface.php, line 15
Namespace
Drupal\Core\AccessView source
interface AccessResultReasonInterface extends AccessResultInterface {
/**
* Gets the reason for this access result.
*
* @return string
* The reason of this access result or an empty string if no reason is
* provided.
*/
public function getReason();
/**
* Sets the reason for this access result.
*
* @param string|null $reason
* The reason of this access result or NULL if no reason is provided.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result instance.
*/
public function setReason($reason);
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|
AccessResultInterface::andIf | public | function | Combine this access result with another using AND. | 2 |
AccessResultInterface::isAllowed | public | function | Checks whether this access result indicates access is explicitly allowed. | 2 |
AccessResultInterface::isForbidden | public | function | Checks whether this access result indicates access is explicitly forbidden. | 2 |
AccessResultInterface::isNeutral | public | function | Checks whether this access result indicates access is not yet determined. | 2 |
AccessResultInterface::orIf | public | function | Combine this access result with another using OR. | 2 |
AccessResultReasonInterface::getReason | public | function | Gets the reason for this access result. | 2 |
AccessResultReasonInterface::setReason | public | function | Sets the reason for this access result. | 2 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.