You are here

function menutree_tree in MenuTree 5

Returns a rendered menu tree.

This is a near-direct copy of menu_tree() from menu.inc. The only difference is that we always call theme(menutree_tree) on the item rather than only if it's in the breadcrumb

Parameters

$pid: The parent id of the menu.

1 call to menutree_tree()
theme_menutree_tree in ./menutree.module
Generate the HTML for a menu tree.

File

./menutree.module, line 227
This module provides a simple "site map" tree based on the menu system rather than on taxonomies.

Code

function menutree_tree($pid = 1) {
  $menu = menu_get_menu();
  $output = '';
  if (isset($menu['visible'][$pid]) && $menu['visible'][$pid]['children']) {
    foreach ($menu['visible'][$pid]['children'] as $mid) {
      $type = isset($menu['visible'][$mid]['type']) ? $menu['visible'][$mid]['type'] : NULL;
      $children = isset($menu['visible'][$mid]['children']) ? $menu['visible'][$mid]['children'] : NULL;
      $output .= theme('menu_item', $mid, theme('menutree_tree', $mid), count($children) == 0);
    }
  }
  return $output;
}