Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. User.php

function User::getDisplayName

Overrides AccountInterface::getDisplayName

1 call to User::getDisplayName()
User::label in core/modules/user/src/Entity/User.php
Gets the label of the entity.

File

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

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal