Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CurrentUserContext.php

function 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\ContextProvider

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal