You are here

function admin_menu_tree in Admin 6

Retrieve a hierarchy of links representing select portions of the 'admin' branch of the navigation menu.

1 call to admin_menu_tree()
admin_preprocess_page in ./admin.module
Implementation of hook_preprocess_page().

File

./admin.module, line 474

Code

function admin_menu_tree() {
  $links = array();

  // Retrieve the admin menu from the database.
  $tree = admin_get_menu_tree();
  admin_menu_tree_links($tree, $links);

  // Add user-specific links
  global $user;
  $user_links = array();
  if (empty($user->uid)) {
    $user_links[] = array(
      'title' => t('Login'),
      'href' => 'user',
      'html' => TRUE,
    );
    $user_links[] = array(
      'title' => t('Register'),
      'href' => 'user/register',
      'html' => TRUE,
    );
  }
  else {
    $user_links[] = array(
      'title' => t('Hello <strong>!username</strong>', array(
        '!username' => $user->name,
      )),
      'href' => 'user',
      'html' => TRUE,
    );
    $user_links[] = array(
      'title' => t('Logout'),
      'href' => "logout",
    );
  }
  $links[0]['user'] = $user_links;
  return $links;
}