menu_tree

Versions
4.6 – 5
menu_tree($pid = 1)
6
menu_tree($menu_name = 'navigation')
7
menu_tree($menu_name)

Returns a rendered menu tree.

Parameters

$pid The parent id of the menu.

Related topics

Code

includes/menu.inc, line 567

<?php
function menu_tree($pid = 1) {
  $menu = menu_get_menu();
  $output = '';

  if (isset($menu['visible'][$pid]) && $menu['visible'][$pid]['children']) {
    foreach ($menu['visible'][$pid]['children'] as $mid) {
      $output .= theme('menu_item', $mid, menu_in_active_trail($mid) || ($menu['visible'][$mid]['type'] & MENU_EXPANDED) ? theme('menu_tree', $mid) : '', count($menu['visible'][$mid]['children']) == 0);
    }
  }

  return $output;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.