You are here

function hook_social_user_account_header_items in Open Social 8.9

Same name and namespace in other branches
  1. 8.4 modules/social_features/social_user/social_user.api.php \hook_social_user_account_header_items()
  2. 8.5 modules/social_features/social_user/social_user.api.php \hook_social_user_account_header_items()
  3. 8.6 modules/social_features/social_user/social_user.api.php \hook_social_user_account_header_items()
  4. 8.7 modules/social_features/social_user/social_user.api.php \hook_social_user_account_header_items()
  5. 8.8 modules/social_features/social_user/social_user.api.php \hook_social_user_account_header_items()
  6. 10.3.x modules/social_features/social_user/social_user.api.php \hook_social_user_account_header_items()
  7. 10.0.x modules/social_features/social_user/social_user.api.php \hook_social_user_account_header_items()
  8. 10.1.x modules/social_features/social_user/social_user.api.php \hook_social_user_account_header_items()
  9. 10.2.x modules/social_features/social_user/social_user.api.php \hook_social_user_account_header_items()

Allows a module to add a link in the account header block.

Parameters

array $context: The context that was provided to the block rendering these links.

Return value

array An associative array of items that should be added in the account header block. The key of the items should be a unique item name.

See also

\Drupal\social_user\Element\AccountHeaderElement

3 functions implement hook_social_user_account_header_items()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

social_activity_social_user_account_header_items in modules/social_features/social_activity/social_activity.module
Implements hook_social_user_account_header_items().
social_group_social_user_account_header_items in modules/social_features/social_group/social_group.module
Implements hook_social_user_account_header_items().
social_private_message_social_user_account_header_items in modules/social_features/social_private_message/social_private_message.module
Implements hook_social_user_account_header_items().
1 invocation of hook_social_user_account_header_items()
AccountHeaderBlock::build in modules/social_features/social_user/src/Plugin/Block/AccountHeaderBlock.php
Builds and returns the renderable array for this block plugin.

File

modules/social_features/social_user/social_user.api.php, line 122
Hooks provided by the Social_user module.

Code

function hook_social_user_account_header_items(array $context) {

  // Uses an AccountHeaderElement to easily render a private message shortcut.
  $num_account_messages = 5;
  return [
    'messages' => [
      '#type' => 'account_header_element',
      '#wrapper_attributes' => [
        'class' => [
          'desktop',
        ],
      ],
      '#title' => new TranslatableMarkup('Inbox'),
      '#url' => Url::fromRoute('social_private_message.inbox'),
      '#icon' => 'icon-message',
      '#label' => (string) $num_account_messages,
    ],
  ];
}