function EntityReferenceFormatterBase::checkAccess
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase::checkAccess()
- 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase::checkAccess()
- 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase::checkAccess()
Checks access to the given entity.
By default, entity 'view' access is checked. However, a subclass can choose to exclude certain items from entity access checking by immediately granting access.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to check.
Return value
\Drupal\Core\Access\AccessResult A cacheable access result.
1 call to EntityReferenceFormatterBase::checkAccess()
- EntityReferenceFormatterBase::getEntitiesToView in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ EntityReferenceFormatterBase.php - Returns the referenced entities for display.
3 methods override EntityReferenceFormatterBase::checkAccess()
- AuthorFormatter::checkAccess in core/
modules/ user/ src/ Plugin/ Field/ FieldFormatter/ AuthorFormatter.php - Checks access to the given entity.
- EntityReferenceLabelFormatter::checkAccess in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ EntityReferenceLabelFormatter.php - Checks access to the given entity.
- FileFormatterBase::checkAccess in core/
modules/ file/ src/ Plugin/ Field/ FieldFormatter/ FileFormatterBase.php - Checks access to the given entity.
File
-
core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ EntityReferenceFormatterBase.php, line 183
Class
- EntityReferenceFormatterBase
- Parent plugin for entity reference formatters.
Namespace
Drupal\Core\Field\Plugin\Field\FieldFormatterCode
protected function checkAccess(EntityInterface $entity) {
return $entity->access('view', NULL, TRUE);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.