UserSession::getPreferredLangcode

UserSession::getPreferredLangcode($fallback_to_default = TRUE) 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 The language code that is preferred by the account. If the preferred language is not set or is a language not configured anymore on the site, the site default is returned or an empty string is returned (i

UserSession::getRoles

public UserSession::getRoles($exclude_locked_roles = FALSE) Returns a list of roles. Parameters bool $exclude_locked_roles: (optional) If TRUE, locked roles (anonymous/authenticated) are not returned. Return value array List of role IDs. Overrides AccountInterface::getRoles File core/lib/Drupal/Core/Session/UserSession.php, line 92 Class UserSession An implementation of the user account interface for the global user. Namespace Drupal\Core\Session Code public function getRoles($exclud

UserSession::getRoleStorage

protected UserSession::getRoleStorage() Returns the role storage object. Return value \Drupal\user\RoleStorageInterface The role storage object. File core/lib/Drupal/Core/Session/UserSession.php, line 204 Class UserSession An implementation of the user account interface for the global user. Namespace Drupal\Core\Session Code protected function getRoleStorage() { return \Drupal::entityManager()->getStorage('user_role'); }

UserSession::getTimeZone

public UserSession::getTimeZone() Returns the timezone of this account. Return value string Name of the timezone. Overrides AccountInterface::getTimeZone File core/lib/Drupal/Core/Session/UserSession.php, line 187 Class UserSession An implementation of the user account interface for the global user. Namespace Drupal\Core\Session Code public function getTimeZone() { return $this->timezone; }

UserSession::getUsername

public UserSession::getUsername() Returns the unaltered login name of this account. Return value string An unsanitized plain-text string with the name of this account that is used to log in. Only display this name to admins and to the user who owns this account, and only in the context of the name used to log in. For any other display purposes, use \Drupal\Core\Session\AccountInterface::getDisplayName() instead. Overrides AccountInterface::getUsername Deprecated in Drupal 8.0.0, will be remo

UserSession::hasPermission

public UserSession::hasPermission($permission) Checks whether a user has a certain permission. Parameters string $permission: The permission string to check. Return value bool TRUE if the user has the permission, FALSE otherwise. Overrides AccountInterface::hasPermission File core/lib/Drupal/Core/Session/UserSession.php, line 105 Class UserSession An implementation of the user account interface for the global user. Namespace Drupal\Core\Session Code public function hasPermission($per

UserSession::id

public UserSession::id() Returns the user ID or 0 for anonymous. Return value int The user ID. Overrides AccountInterface::id File core/lib/Drupal/Core/Session/UserSession.php, line 85 Class UserSession An implementation of the user account interface for the global user. Namespace Drupal\Core\Session Code public function id() { return $this->uid; }

UserSession::isAnonymous

public UserSession::isAnonymous() Returns TRUE if the account is anonymous. Return value bool TRUE if the account is anonymous. Overrides AccountInterface::isAnonymous File core/lib/Drupal/Core/Session/UserSession.php, line 124 Class UserSession An implementation of the user account interface for the global user. Namespace Drupal\Core\Session Code public function isAnonymous() { return $this->uid == 0; }

UserSession::isAuthenticated

public UserSession::isAuthenticated() Returns TRUE if the account is authenticated. Return value bool TRUE if the account is authenticated. Overrides AccountInterface::isAuthenticated File core/lib/Drupal/Core/Session/UserSession.php, line 117 Class UserSession An implementation of the user account interface for the global user. Namespace Drupal\Core\Session Code public function isAuthenticated() { return $this->uid > 0; }

UserSession::__construct

public UserSession::__construct(array $values = array()) Constructs a new user session. Parameters array $values: Array of initial values for the user session. File core/lib/Drupal/Core/Session/UserSession.php, line 76 Class UserSession An implementation of the user account interface for the global user. Namespace Drupal\Core\Session Code public function __construct(array $values = array()) { foreach ($values as $key => $value) { $this->$key = $value; } }