EntityAccess
class EntityAccess implements ContainerInjectionInterface (View source)
| internal |
Service wrapper for hooks relating to entity access control.
Traits
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
Properties
| protected TranslationInterface | $stringTranslation | The string translation service. |
from StringTranslationTrait |
| protected EntityTypeManagerInterface | $entityTypeManager | The entity type manager service. |
|
| protected WorkspaceManagerInterface | $workspaceManager | The workspace manager service. |
Methods
Translates a string to the current language or to a given language.
Formats a string containing a count of items.
Returns the number of plurals supported by a given language.
Gets the string translation service.
Constructs a new EntityAccess instance.
Instantiates a new instance of this class.
Implements a hook bridge for hook_entity_access().
Implements a hook bridge for hook_entity_create_access().
Details
protected TranslatableMarkup
t(string $string, array $args = [], array $options = [])
Translates a string to the current language or to a given language.
See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for important security information and usage guidelines.
In order for strings to be localized, make them available in one of the ways supported by the
protected
formatPlural($count, $singular, $plural, array $args = [], array $options = [])
Formats a string containing a count of items.
protected
getNumberOfPlurals($langcode = NULL)
Returns the number of plurals supported by a given language.
protected TranslationInterface
getStringTranslation()
Gets the string translation service.
$this
setStringTranslation(TranslationInterface $translation)
Sets the string translation service to use.
__construct(EntityTypeManagerInterface $entity_type_manager, WorkspaceManagerInterface $workspace_manager)
Constructs a new EntityAccess instance.
static
create(ContainerInterface $container)
Instantiates a new instance of this class.
This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.
AccessResult
entityOperationAccess(EntityInterface $entity, string $operation, AccountInterface $account)
Implements a hook bridge for hook_entity_access().
AccessResult
entityCreateAccess(AccountInterface $account, array $context, string $entity_bundle)
Implements a hook bridge for hook_entity_create_access().
protected AccessResult
bypassAccessResult(AccountInterface $account)
Checks the 'bypass' permissions.