EntityAccessControlHandlerInterface
interface EntityAccessControlHandlerInterface (View source)
Defines an interface for entity access control handlers.
Methods
Checks access to an operation on a given entity or entity translation.
Checks access to create an entity.
Clears all cached access checks.
Sets the module handler for this access control handler.
Checks access to an operation on a given entity field.
Details
bool|AccessResultInterface
access(EntityInterface $entity, string $operation, AccountInterface $account = NULL, bool $return_as_object = FALSE)
Checks access to an operation on a given entity or entity translation.
Use \Drupal\Core\Entity\EntityAccessControlHandlerInterface::createAccess() to check access to create an entity.
bool|AccessResultInterface
createAccess(string $entity_bundle = NULL, AccountInterface $account = NULL, array $context = [], bool $return_as_object = FALSE)
Checks access to create an entity.
resetCache()
Clears all cached access checks.
$this
setModuleHandler(ModuleHandlerInterface $module_handler)
Sets the module handler for this access control handler.
bool|AccessResultInterface
fieldAccess(string $operation, FieldDefinitionInterface $field_definition, AccountInterface $account = NULL, FieldItemListInterface $items = NULL, bool $return_as_object = FALSE)
Checks access to an operation on a given entity field.
This method does not determine whether access is granted to the entity itself, only the specific field. Callers are responsible for ensuring that entity access is also respected, for example by using \Drupal\Core\Entity\EntityAccessControlHandlerInterface::access().