function EntityAccess::entityCreateAccess
Same name in other branches
- 8.9.x core/modules/workspaces/src/EntityAccess.php \Drupal\workspaces\EntityAccess::entityCreateAccess()
- 10 core/modules/workspaces/src/EntityAccess.php \Drupal\workspaces\EntityAccess::entityCreateAccess()
- 11.x core/modules/workspaces/src/EntityAccess.php \Drupal\workspaces\EntityAccess::entityCreateAccess()
Implements a hook bridge for hook_entity_create_access().
Parameters
\Drupal\Core\Session\AccountInterface $account: The user account making the to check access for.
array $context: The context of the access check.
string $entity_bundle: The bundle of the entity.
Return value
\Drupal\Core\Access\AccessResult The result of the access check.
See also
File
-
core/
modules/ workspaces/ src/ EntityAccess.php, line 100
Class
- EntityAccess
- Service wrapper for hooks relating to entity access control.
Namespace
Drupal\workspacesCode
public function entityCreateAccess(AccountInterface $account, array $context, $entity_bundle) {
// 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.
$entity_type = $this->entityTypeManager
->getDefinition($context['entity_type_id']);
if ($entity_type->id() === 'workspace' || !$this->workspaceManager
->isEntityTypeSupported($entity_type) || !$this->workspaceManager
->hasActiveWorkspace()) {
return AccessResult::neutral();
}
return $this->bypassAccessResult($account);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.