function uma_getUser in User Menu Avatar (User Image in Menu) 8.4
Same name and namespace in other branches
- 8.5 user_menu_avatar.module \uma_getUser()
Get the current user.
File
- ./
user_menu_avatar.module, line 16 - Display user picture and/or user name in menu.
Code
function uma_getUser() {
// Get current user ID.
$userID = \Drupal::currentUser()
->id();
// Load the current user by user ID.
$currentUser = User::load($userID);
return [
'user_id' => $userID,
'currentUser' => $currentUser,
];
}