public function Account::getUsername in Service Container 7.2
Same name and namespace in other branches
- 7 src/Session/Account.php \Drupal\service_container\Session\Account::getUsername()
Returns the username of this account.
By default, the passed-in object's 'name' property is used if it exists, or else, the site-defined value for the 'anonymous' variable. However, a module may override this by implementing hook_user_format_name_alter(&$name, $account).
Return value
An unsanitized string with the username to display. The code receiving this result must ensure that \Drupal\Component\Utility\SafeMarkup::checkPlain() is called on it before it is printed to the page.
Overrides AccountInterface::getUsername
See also
hook_user_format_name_alter()
File
- src/
Session/ Account.php, line 127 - Contains \Drupal\service_container\Session\Account.
Class
- Account
- Wraps the global user to provide the account interface.
Namespace
Drupal\service_container\SessionCode
public function getUsername() {
return $GLOBALS['user']->name;
}