hook_ENTITY_TYPE_access

hook_ENTITY_TYPE_access(\Drupal\Core\Entity\EntityInterface $entity, $operation, \Drupal\Core\Session\AccountInterface $account)

Control entity operation access for a specific entity type.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to check access to.

string $operation: The operation that is to be performed on $entity.

\Drupal\Core\Session\AccountInterface $account: The account trying to access the entity.

Return value

\Drupal\Core\Access\AccessResultInterface The access result. hook_entity_access() has detailed documentation.

See also

\Drupal\Core\Entity\EntityAccessControlHandler

hook_ENTITY_TYPE_create_access()

hook_entity_access()

Related topics

Entity API
Describes how to define and manipulate content and configuration entities.
Hooks
Define functions that alter the behavior of Drupal core.

File

core/lib/Drupal/Core/Entity/entity.api.php, line 591
Hooks and documentation related to entities.

Code

function hook_ENTITY_TYPE_access(\Drupal\Core\Entity\EntityInterface $entity, $operation, \Drupal\Core\Session\AccountInterface $account) {
  // No opinion.
  return AccessResult::neutral();
}
doc_Drupal
2016-10-29 09:18:02
Comments
Leave a Comment

Please login to continue.