function Test::entityOperationAccess2 in Coder 8.3.x
Same name and namespace in other branches
- 8.3 tests/Drupal/Commenting/HookCommentUnitTest.inc \Test::entityOperationAccess2()
Implements a hook bridge for hook_entity_access().
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to check access for.
string $operation: The operation being performed.
\Drupal\Core\Session\AccountInterface $account: The user account making the to check access for.
Return value
\Drupal\Core\Access\AccessResult The result of the access check.
See also
File
- tests/
Drupal/ Commenting/ HookCommentUnitTest.inc, line 60 - Example file with hook implementations.
Class
- Test
- Has a method doc comment that is not a hook implementation.
Code
function entityOperationAccess2(EntityInterface $entity, $operation, AccountInterface $account) {
// Workspaces themselves are handled by their own access handler and we
// should not try to do any access checks for entity types that can not
// belong to a workspace.
if ($entity
->getEntityTypeId() === 'workspace' || !$this->workspaceManager
->isEntityTypeSupported($entity
->getEntityType())) {
return AccessResult::neutral();
}
return $this
->bypassAccessResult($account);
}