function UserController::userTitle
Same name in other branches
- 8.9.x core/modules/user/src/Controller/UserController.php \Drupal\user\Controller\UserController::userTitle()
- 10 core/modules/user/src/Controller/UserController.php \Drupal\user\Controller\UserController::userTitle()
- 11.x core/modules/user/src/Controller/UserController.php \Drupal\user\Controller\UserController::userTitle()
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 352
Class
- UserController
- Controller routines for user routes.
Namespace
Drupal\user\ControllerCode
public function userTitle(UserInterface $user = NULL) {
return $user ? [
'#markup' => $user->getDisplayName(),
'#allowed_tags' => Xss::getHtmlTagList(),
] : '';
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.