function CurrentUserContext::__construct
Same name in other branches
- 9 core/modules/user/src/ContextProvider/CurrentUserContext.php \Drupal\user\ContextProvider\CurrentUserContext::__construct()
- 8.9.x core/modules/user/src/ContextProvider/CurrentUserContext.php \Drupal\user\ContextProvider\CurrentUserContext::__construct()
- 11.x 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\EntityTypeManagerInterface $entity_type_manager: The entity type manager.
File
-
core/
modules/ user/ src/ ContextProvider/ CurrentUserContext.php, line 41
Class
- CurrentUserContext
- Sets the current user as a context.
Namespace
Drupal\user\ContextProviderCode
public function __construct(AccountInterface $account, EntityTypeManagerInterface $entity_type_manager) {
$this->account = $account;
$this->userStorage = $entity_type_manager->getStorage('user');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.