You are here

function menu_overview_tree in Drupal 5

Same name and namespace in other branches
  1. 4 modules/menu.module \menu_overview_tree()

Present the menu tree, rendered along with links to edit menu items.

1 call to menu_overview_tree()
menu_overview in modules/menu/menu.module
Menu callback; present the main menu management page.

File

modules/menu/menu.module, line 608
Allows administrators to customize the site navigation menu.

Code

function menu_overview_tree() {
  $menu = menu_get_menu();
  $root_menus = menu_get_root_menus();
  $header = array(
    t('Menu item'),
    t('Expanded'),
    array(
      'data' => t('Operations'),
      'colspan' => '3',
    ),
  );
  $output = '';

  // We reverse the root menu to show user created menus first.
  foreach (array_reverse($root_menus, true) as $mid => $title) {
    $operations = array();
    if ($menu['items'][$mid]['type'] & MENU_MODIFIABLE_BY_ADMIN) {
      $operations[] = l(t('Edit'), 'admin/build/menu/menu/edit/' . $mid);
    }
    if ($menu['items'][$mid]['type'] & MENU_CREATED_BY_ADMIN) {
      $operations[] = l(t('Delete'), 'admin/build/menu/menu/delete/' . $mid);
    }
    $operations[] = l(t('Add item'), 'admin/build/menu/item/add/' . $mid);
    $table = theme('item_list', $operations);
    $rows = menu_overview_tree_rows($mid);
    $table .= theme('table', $header, $rows ? $rows : array(
      array(
        array(
          'data' => t('No menu items defined.'),
          'colspan' => 5,
        ),
      ),
    ));
    $output .= theme('box', check_plain($title), $table);
  }
  return $output;
}