You are here

public function User::getAccountName in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/user/src/Entity/User.php \Drupal\user\Entity\User::getAccountName()

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 login. For any other display purposes, use \Drupal\Core\Session\AccountInterface::getDisplayName() instead.

Overrides AccountInterface::getAccountName

1 call to User::getAccountName()
User::getDisplayName in core/modules/user/src/Entity/User.php
Returns the display name of this account.

File

core/modules/user/src/Entity/User.php, line 375

Class

User
Defines the user entity class.

Namespace

Drupal\user\Entity

Code

public function getAccountName() {
  return $this
    ->get('name')->value ?: '';
}