public static function UserStatisticsManager::getDefaultUserPicture in Opigno statistics 3.x
Get the default user image.
Parameters
\Drupal\user\UserInterface|NULL $user: The user to display the image for.
Return value
array Render array to display the default user image.
1 call to UserStatisticsManager::getDefaultUserPicture()
- UserStatisticsManager::getUserPicture in src/
Services/ UserStatisticsManager.php - Get the default user picture.
File
- src/
Services/ UserStatisticsManager.php, line 605
Class
- UserStatisticsManager
- User statistics manager service definition.
Namespace
Drupal\opigno_statistics\ServicesCode
public static function getDefaultUserPicture(?UserInterface $user = NULL) : array {
$path = drupal_get_path('theme', 'aristotle') . '/src/images/content/profil.svg';
$name = $user instanceof UserInterface ? $user
->getDisplayName() : t('User');
return [
'#theme' => 'image',
'#uri' => file_exists($path) ? file_url_transform_relative(base_path() . $path) : '',
'#alt' => $name,
'#title' => $name,
];
}