public function RngEntityAccess::hook_entity_access in RNG - Events and Registrations 8
Same name and namespace in other branches
- 8.2 src/RngEntityAccess.php \Drupal\rng\RngEntityAccess::hook_entity_access()
- 3.x src/RngEntityAccess.php \Drupal\rng\RngEntityAccess::hook_entity_access()
Control entity operation access.
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.
See also
File
- src/
RngEntityAccess.php, line 49
Class
- RngEntityAccess
- RNG entity access.
Namespace
Drupal\rngCode
public function hook_entity_access(EntityInterface $entity, $operation, AccountInterface $account) {
if ('manage event' == $operation && $this->eventManager
->isEvent($entity)) {
return $this
->manageEventAccess($entity, $account);
}
if ('update' == $operation && $entity instanceof ChannelInterface) {
return $this
->updateCourierMessageAccess($entity, $account);
}
if ('templates' == $operation && $entity instanceof TemplateCollectionInterface) {
return $this
->templateCollectionTemplateAccess($entity, $account);
}
return AccessResult::neutral();
}