You are here

function social_event_social_user_account_header_account_links in Open Social 8.4

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/social_event.module \social_event_social_user_account_header_account_links()
  2. 8.5 modules/social_features/social_event/social_event.module \social_event_social_user_account_header_account_links()
  3. 8.6 modules/social_features/social_event/social_event.module \social_event_social_user_account_header_account_links()
  4. 8.7 modules/social_features/social_event/social_event.module \social_event_social_user_account_header_account_links()
  5. 8.8 modules/social_features/social_event/social_event.module \social_event_social_user_account_header_account_links()
  6. 10.3.x modules/social_features/social_event/social_event.module \social_event_social_user_account_header_account_links()
  7. 10.0.x modules/social_features/social_event/social_event.module \social_event_social_user_account_header_account_links()
  8. 10.1.x modules/social_features/social_event/social_event.module \social_event_social_user_account_header_account_links()
  9. 10.2.x modules/social_features/social_event/social_event.module \social_event_social_user_account_header_account_links()

Implements hook_social_user_account_header_account_links().

Adds the "View my events" link to the user menu.

File

modules/social_features/social_event/social_event.module, line 348
The Social event module.

Code

function social_event_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_events' => [
      '#type' => 'link',
      '#attributes' => [
        'title' => new TranslatableMarkup('View my events'),
      ],
      '#title' => new TranslatableMarkup('My events'),
      '#weight' => 600,
    ] + Url::fromRoute('view.events.events_overview', [
      'user' => $context['user']
        ->id(),
    ])
      ->toRenderArray(),
  ];
}