function social_album_social_user_account_header_account_links in Open Social 10.2.x
Same name and namespace in other branches
- 10.3.x modules/social_features/social_album/social_album.module \social_album_social_user_account_header_account_links()
- 10.0.x modules/social_features/social_album/social_album.module \social_album_social_user_account_header_account_links()
- 10.1.x modules/social_features/social_album/social_album.module \social_album_social_user_account_header_account_links()
Implements hook_social_user_account_header_account_links().
Adds the "View my albums" link to the user menu.
File
- modules/
social_features/ social_album/ social_album.module, line 506 - The Social Album module.
Code
function social_album_social_user_account_header_account_links(array $context) {
// We require a user for this link.
if (empty($context['user']) || !$context['user'] instanceof AccountInterface) {
return [];
}
return [
'my_albums' => [
'#type' => 'link',
'#attributes' => [
'title' => new TranslatableMarkup('View my albums'),
],
'#title' => new TranslatableMarkup('My albums'),
'#weight' => 550,
] + Url::fromRoute('view.albums.page_albums_overview', [
'user' => $context['user']
->id(),
])
->toRenderArray(),
];
}