protected function 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

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityAccessControlHandler.php/function/EntityAccessControlHandler::prepareUser/8.1.x