EntityAccessControlHandler::prepareUser

protected EntityAccessControlHandler::prepareUser(AccountInterface $account = NULL)

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.

File

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

Class

EntityAccessControlHandler
Defines a default implementation for entity access control handler.

Namespace

Drupal\Core\Entity

Code

1
2
3
4
5
6
protected function prepareUser(AccountInterface $account = NULL) {
  if (!$account) {
    $account = \Drupal::currentUser();
  }
  return $account;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.