You are here

public function AccountProxy::getPreferredLangcode in Restrict Login or Role Access by IP Address 8.4

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/Session/AccountProxy.php, line 104
Contains \Drupal\restrict_by_ip\Session\AccountProxy.

Class

AccountProxy
When the current user is loaded, remove any roles that are restricted based on IP whitelists. Proxy all other method calls to the original current_user service.

Namespace

Drupal\restrict_by_ip\Session

Code

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