protected function AuthorFormatter::checkAccess in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/user/src/Plugin/Field/FieldFormatter/AuthorFormatter.php \Drupal\user\Plugin\Field\FieldFormatter\AuthorFormatter::checkAccess()
Checks access to the given entity.
By default, entity 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.
Overrides EntityReferenceFormatterBase::checkAccess
File
- core/
modules/ user/ src/ Plugin/ Field/ FieldFormatter/ AuthorFormatter.php, line 61 - Contains \Drupal\user\Plugin\Field\FieldFormatter\AuthorFormatter.
Class
- AuthorFormatter
- Plugin implementation of the 'author' formatter.
Namespace
Drupal\user\Plugin\Field\FieldFormatterCode
protected function checkAccess(EntityInterface $entity) {
// Always allow an entity author's username to be read, even if the current
// user does not have permission to view the entity author's profile.
return AccessResult::allowed();
}