interface AccessResultReasonInterface in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Access/AccessResultReasonInterface.php \Drupal\Core\Access\AccessResultReasonInterface
- 10 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
Expanded class hierarchy of AccessResultReasonInterface
All classes that implement AccessResultReasonInterface
See also
\Drupal\Core\Access\AccessResultInterface
14 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 - Contains \Drupal\Tests\Core\Access\AccessResultTest.
- 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 - EntityAccessDeniedHttpException.php in core/
modules/ jsonapi/ src/ Exception/ EntityAccessDeniedHttpException.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|null
* The reason of this access result or NULL if no reason is provided.
*/
public function getReason();
/**
* Sets the reason for this access result.
*
* @param $reason string|null
* 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AccessResultInterface:: |
public | function | Combine this access result with another using AND. | 2 |
AccessResultInterface:: |
public | function | Checks whether this access result indicates access is explicitly allowed. | 2 |
AccessResultInterface:: |
public | function | Checks whether this access result indicates access is explicitly forbidden. | 2 |
AccessResultInterface:: |
public | function | Checks whether this access result indicates access is not yet determined. | 2 |
AccessResultInterface:: |
public | function | Combine this access result with another using OR. | 2 |
AccessResultReasonInterface:: |
public | function | Gets the reason for this access result. | 2 |
AccessResultReasonInterface:: |
public | function | Sets the reason for this access result. | 2 |