You are here

public function EntityBase::access in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::access()
  2. 9 core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::access()
1 method overrides EntityBase::access()
ContentEntityBase::access in core/lib/Drupal/Core/Entity/ContentEntityBase.php
Checks data value access.

File

core/lib/Drupal/Core/Entity/EntityBase.php, line 306

Class

EntityBase
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
  if ($operation == 'create') {
    return $this
      ->entityTypeManager()
      ->getAccessControlHandler($this->entityTypeId)
      ->createAccess($this
      ->bundle(), $account, [], $return_as_object);
  }
  return $this
    ->entityTypeManager()
    ->getAccessControlHandler($this->entityTypeId)
    ->access($this, $operation, $account, $return_as_object);
}