You are here

public function User::getDisplayName in Drupal 10

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

File

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

Class

User
Defines the user entity class.

Namespace

Drupal\user\Entity

Code

public function getDisplayName() {
  $name = $this
    ->getAccountName() ?: \Drupal::config('user.settings')
    ->get('anonymous');
  \Drupal::moduleHandler()
    ->alter('user_format_name', $name, $this);
  return $name;
}