User::getAccountName

public 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

File

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

Class

User
Defines the user entity class.

Namespace

Drupal\user\Entity

Code

1
2
3
public function getAccountName() {
  return $this->get('name')->value ? : '';
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.