function social_user_social_user_account_header_account_links in Open Social 8.5
Same name and namespace in other branches
- 8.9 modules/social_features/social_user/social_user.module \social_user_social_user_account_header_account_links()
- 8.4 modules/social_features/social_user/social_user.module \social_user_social_user_account_header_account_links()
- 8.6 modules/social_features/social_user/social_user.module \social_user_social_user_account_header_account_links()
- 8.7 modules/social_features/social_user/social_user.module \social_user_social_user_account_header_account_links()
- 8.8 modules/social_features/social_user/social_user.module \social_user_social_user_account_header_account_links()
- 10.3.x modules/social_features/social_user/social_user.module \social_user_social_user_account_header_account_links()
- 10.0.x modules/social_features/social_user/social_user.module \social_user_social_user_account_header_account_links()
- 10.1.x modules/social_features/social_user/social_user.module \social_user_social_user_account_header_account_links()
- 10.2.x modules/social_features/social_user/social_user.module \social_user_social_user_account_header_account_links()
Implements hook_social_user_account_header_account_links().
Adds the "View my profile" and "Edit profile" link to the user menu.
File
- modules/
social_features/ social_user/ social_user.module, line 499 - The social user module alterations.
Code
function social_user_social_user_account_header_account_links(array $context) {
// We require a user for these links.
if (empty($context['user']) || !$context['user'] instanceof AccountInterface) {
return [];
}
return [
'my_account' => [
'#type' => 'link',
'#attributes' => [
'title' => new TranslatableMarkup("Settings"),
],
'#title' => new TranslatableMarkup("Settings"),
'#weight' => 1200,
] + Url::fromRoute('entity.user.edit_form', [
'user' => $context['user']
->id(),
])
->toRenderArray(),
'divider_logout' => [
"#wrapper_attributes" => [
"class" => [
"divider",
],
"role" => "separator",
],
'#weight' => 1400,
],
'logout' => [
'#type' => 'link',
'#attributes' => [
'title' => new TranslatableMarkup("Logout"),
],
'#title' => new TranslatableMarkup("Logout"),
'#weight' => 1500,
] + Url::fromRoute('user.logout')
->toRenderArray(),
];
}