You are here

function admin_menu_links_account in Administration menu 7.3

Same name and namespace in other branches
  1. 8.3 admin_menu.inc \admin_menu_links_account()

Builds the account links.

See also

theme_admin_menu_links()

1 call to admin_menu_links_account()
admin_menu_output in ./admin_menu.module
Build the administration menu output.

File

./admin_menu.inc, line 529
Menu builder functions for Administration menu.

Code

function admin_menu_links_account() {
  $links = array(
    '#theme' => 'admin_menu_links',
    '#wrapper_attributes' => array(
      'id' => 'admin-menu-account',
    ),
    '#weight' => 100,
  );
  $links['account'] = array(
    '#title' => format_username($GLOBALS['user']),
    '#weight' => -99,
    '#attributes' => array(
      'class' => array(
        'admin-menu-action',
        'admin-menu-account',
      ),
    ),
    '#href' => 'user/' . $GLOBALS['user']->uid,
  );
  $links['logout'] = array(
    '#title' => t('Log out'),
    '#weight' => -100,
    '#attributes' => array(
      'class' => array(
        'admin-menu-action',
      ),
    ),
    '#href' => 'user/logout',
  );

  // Add Devel module switch user links.
  $switch_links = module_invoke('devel', 'switch_user_list');
  if (!empty($switch_links) && count($switch_links) > 1) {
    foreach ($switch_links as $uid => $link) {
      $links['account'][$link['title']] = array(
        '#title' => $link['title'],
        '#description' => $link['attributes']['title'],
        '#href' => $link['href'],
        '#options' => array(
          'query' => $link['query'],
          'html' => !empty($link['html']),
        ),
      );
    }
  }
  return $links;
}