public function UserConfigContext::setAccount

Creates the configuration context for user accounts.

Parameters

\Drupal\user\UserInterface $account: The account to add to the config context.

Return value

\Drupal\user\UserConfigContext The user config context object.

File

drupal/core/modules/user/lib/Drupal/user/UserConfigContext.php, line 38
Contains \Drupal\user\UserConfigContext.

Class

UserConfigContext
Defines a configuration context object for a user account.

Namespace

Drupal\user

Code

public function setAccount(UserInterface $account) {
  $this
    ->set(self::USER_KEY, $account);

  // Re-initialize since the user change changes the context fundamentally.
  $this
    ->init();
  return $this;
}