You are here

protected function EntityAccessControlHandler::prepareUser in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php \Drupal\Core\Entity\EntityAccessControlHandler::prepareUser()
  2. 9 core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php \Drupal\Core\Entity\EntityAccessControlHandler::prepareUser()

Loads the current account object, if it does not exist yet.

Parameters

\Drupal\Core\Session\AccountInterface $account: The account interface instance.

Return value

\Drupal\Core\Session\AccountInterface Returns the current account object.

6 calls to EntityAccessControlHandler::prepareUser()
EntityAccessControlHandler::access in core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php
Checks access to an operation on a given entity or entity translation.
EntityAccessControlHandler::createAccess in core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php
Checks access to create an entity.
EntityAccessControlHandler::fieldAccess in core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php
Checks access to an operation on a given entity field.
FileAccessControlHandler::checkAccess in core/modules/file/src/FileAccessControlHandler.php
Performs access checks.
NodeAccessControlHandler::access in core/modules/node/src/NodeAccessControlHandler.php
Checks access to an operation on a given entity or entity translation.

... See full list

File

core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php, line 302

Class

EntityAccessControlHandler
Defines a default implementation for entity access control handler.

Namespace

Drupal\Core\Entity

Code

protected function prepareUser(AccountInterface $account = NULL) {
  if (!$account) {
    $account = \Drupal::currentUser();
  }
  return $account;
}