You are here

public function ToolbarLinkBuilder::renderDisplayName in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/user/src/ToolbarLinkBuilder.php \Drupal\user\ToolbarLinkBuilder::renderDisplayName()
  2. 10 core/modules/user/src/ToolbarLinkBuilder.php \Drupal\user\ToolbarLinkBuilder::renderDisplayName()

Lazy builder callback for rendering the username.

Return value

array A renderable array as expected by the renderer service.

File

core/modules/user/src/ToolbarLinkBuilder.php, line 81

Class

ToolbarLinkBuilder
ToolbarLinkBuilder fills out the placeholders generated in user_toolbar().

Namespace

Drupal\user

Code

public function renderDisplayName() {
  return [
    '#markup' => $this->account
      ->getDisplayName(),
  ];
}