public function EntityEmbedDisplayBase::access in Entity Embed 8
Indicates whether this Entity Embed display can be used.
This method allows base implementations to add general access restrictions that should apply to all extending Entity Embed display plugins.
Parameters
\Drupal\Core\Session\AccountInterface $account: (optional) The user for which to check access, or NULL to check access for the current user. Defaults to NULL.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
Overrides EntityEmbedDisplayInterface::access
1 method overrides EntityEmbedDisplayBase::access()
- FieldFormatterEntityEmbedDisplayBase::access in src/
EntityEmbedDisplay/ FieldFormatterEntityEmbedDisplayBase.php - Indicates whether this Entity Embed display can be used.
File
- src/
EntityEmbedDisplay/ EntityEmbedDisplayBase.php, line 93
Class
- EntityEmbedDisplayBase
- Defines a base Entity Embed Display implementation.
Namespace
Drupal\entity_embed\EntityEmbedDisplayCode
public function access(AccountInterface $account = NULL) {
// @todo Add a hook_entity_embed_display_access()?
// Check that the plugin's registered entity types matches the current
// entity type.
return AccessResult::allowedIf($this
->isValidEntityType())
->addCacheTags([
'entity_types',
]);
}