function EntityBase::access

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::access()
  2. 10 core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::access()
  3. 11.x core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::access()

Overrides AccessibleInterface::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 362

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.