You are here

public function AccountInterface::getUsername in Service Container 7.2

Same name and namespace in other branches
  1. 7 lib/Drupal/Core/Session/AccountInterface.php \Drupal\Core\Session\AccountInterface::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.

See also

hook_user_format_name_alter()

1 method overrides AccountInterface::getUsername()
Account::getUsername in src/Session/Account.php
Returns the username of this account.

File

lib/Drupal/Core/Session/AccountInterface.php, line 124
Contains \Drupal\Core\Session\AccountInterface.

Class

AccountInterface
Defines an account interface which represents the current user.

Namespace

Drupal\Core\Session

Code

public function getUsername();