You are here

public function AllowedLanguagesManager::accountFromProxy in Allowed Languages 2.x

Get the actual account entity behind the proxy.

Parameters

\Drupal\Core\Session\AccountInterface $account: The account proxy object to use to get the account entity.

Return value

\Drupal\user\UserInterface The account entity behind the proxy.

Overrides AllowedLanguagesManagerInterface::accountFromProxy

2 calls to AllowedLanguagesManager::accountFromProxy()
AllowedLanguagesManager::assignedLanguages in src/AllowedLanguagesManager.php
Get the allowed languages for the specified user.
AllowedLanguagesManager::hasPermissionForLanguage in src/AllowedLanguagesManager.php
Checks if the user is allowed to translate the specified language.

File

src/AllowedLanguagesManager.php, line 49

Class

AllowedLanguagesManager
The allowed language manager controls access to content by language.

Namespace

Drupal\allowed_languages

Code

public function accountFromProxy(AccountInterface $account = NULL) {
  if ($account === NULL) {
    $account = $this->currentUser;
  }
  if ($account instanceof AccountProxyInterface) {
    $account = $this->entityTypeManager
      ->getStorage('user')
      ->load($account
      ->id());
  }
  return $account;
}