You are here

public function CurrentUserContext::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/ContextProvider/CurrentUserContext.php \Drupal\user\ContextProvider\CurrentUserContext::__construct()

Constructs a new CurrentUserContext.

Parameters

\Drupal\Core\Session\AccountInterface $account: The current user.

\Drupal\Core\Entity\EntityManagerInterface $entity_manager: The entity manager.

File

core/modules/user/src/ContextProvider/CurrentUserContext.php, line 47
Contains \Drupal\user\ContextProvider\CurrentUserContext.

Class

CurrentUserContext
Sets the current user as a context.

Namespace

Drupal\user\ContextProvider

Code

public function __construct(AccountInterface $account, EntityManagerInterface $entity_manager) {
  $this->account = $account;
  $this->userStorage = $entity_manager
    ->getStorage('user');
}