UserController::userTitle

public UserController::userTitle(UserInterface $user = NULL)

Route title callback.

Parameters

\Drupal\user\UserInterface $user: The user account.

Return value

string|array The user account name as a render array or an empty string if $user is NULL.

File

core/modules/user/src/Controller/UserController.php, line 270

Class

UserController
Controller routines for user routes.

Namespace

Drupal\user\Controller

Code

public function userTitle(UserInterface $user = NULL) {
  return $user ? ['#markup' => $user->getUsername(), '#allowed_tags' => Xss::getHtmlTagList()] : '';
}
doc_Drupal
2016-10-29 09:52:28
Comments
Leave a Comment

Please login to continue.