protected function EntityAccessController::getCache

Tries to retrieve a previously cached access value from the static cache.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity for which to check 'create' access.

string $operation: The entity operation. Usually one of 'view', 'edit', 'create' or 'delete'.

string $langcode: The language code for which to check access.

\Drupal\Core\Session\AccountInterface $account: The user for which to check access.

Return value

bool|null TRUE if access was granted, FALSE if access was denied and NULL if there is no record for the given user, operation, langcode and entity in the cache.

1 call to EntityAccessController::getCache()
EntityAccessController::access in drupal/core/lib/Drupal/Core/Entity/EntityAccessController.php
Checks access to an operation on a given entity or entity translation.

File

drupal/core/lib/Drupal/Core/Entity/EntityAccessController.php, line 103
Contains \Drupal\Core\Entity\EntityAccessController.

Class

EntityAccessController
Defines a default implementation for entity access controllers.

Namespace

Drupal\Core\Entity

Code

protected function getCache(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
  $uid = $account ? $account
    ->id() : 0;
  $uuid = $entity
    ->uuid();

  // Return from cache if a value has been set for it previously.
  if (isset($this->accessCache[$uid][$uuid][$langcode][$operation])) {
    return $this->accessCache[$uid][$uuid][$langcode][$operation];
  }
}