You are here

public function TokenAuthUser::getPreferredLangcode in Simple OAuth (OAuth2) & OpenID Connect 8

Same name and namespace in other branches
  1. 8.4 src/Authentication/TokenAuthUser.php \Drupal\simple_oauth\Authentication\TokenAuthUser::getPreferredLangcode()
  2. 8.2 src/Authentication/TokenAuthUser.php \Drupal\simple_oauth\Authentication\TokenAuthUser::getPreferredLangcode()
  3. 8.3 src/Authentication/TokenAuthUser.php \Drupal\simple_oauth\Authentication\TokenAuthUser::getPreferredLangcode()
  4. 5.x src/Authentication/TokenAuthUser.php \Drupal\simple_oauth\Authentication\TokenAuthUser::getPreferredLangcode()

Returns the preferred language code of the account.

Parameters

bool $fallback_to_default: (optional) Whether the return value will fall back to the site default language if the user has no language preference.

Return value

string Returned language code depends upon following:

  • The user preferred language code is returned if set in the account.
  • If the user has no preferred language and $fallback_to_default is TRUE then the site default language code is returned.
  • If the user has no preferred language and $fallback_to_default is FALSE then empty string is returned.

Overrides AccountInterface::getPreferredLangcode

File

src/Authentication/TokenAuthUser.php, line 94

Class

TokenAuthUser
Class TokenAuthUser.

Namespace

Drupal\simple_oauth\Authentication

Code

public function getPreferredLangcode($fallback_to_default = TRUE) {
  return $this->subject
    ->getPreferredLangcode($fallback_to_default);
}