You are here

function theme_admin_menu_tree in Administration menu 5.2

Same name and namespace in other branches
  1. 5.3 admin_menu.module \theme_admin_menu_tree()
  2. 5 admin_menu.inc \theme_admin_menu_tree()

Generate the HTML for a menu tree.

Parameters

int $pid: The menu item id to use for the administration menu.

Return value

string The complete, rendered administration menu.

1 call to theme_admin_menu_tree()
admin_menu_footer in ./admin_menu.module
Implementation of hook_footer().

File

./admin_menu.module, line 239
Renders a menu tree for administrative purposes as dropdown menu at the top of the window.

Code

function theme_admin_menu_tree($pid = 1) {
  $_admin_menu = admin_menu_get_menu();
  $output = '';
  if (isset($_admin_menu[$pid]) && $_admin_menu[$pid]['children']) {

    // Since we allow other modules to add items to admin menu, we need to sort
    // all items (again).
    usort($_admin_menu[$pid]['children'], '_admin_menu_sort');
    foreach ($_admin_menu[$pid]['children'] as $mid) {
      $children = isset($_admin_menu[$mid]['children']) ? $_admin_menu[$mid]['children'] : NULL;
      $output .= theme_admin_menu_item($mid, theme_admin_menu_tree($mid), count($children) == 0);
    }
  }
  return $output ? "\n<ul>" . $output . '</ul>' : '';
}