You are here

function simplemenu_menu_tree in SimpleMenu 5

Same name and namespace in other branches
  1. 6.2 simplemenu.module \simplemenu_menu_tree()
  2. 6 simplemenu.module \simplemenu_menu_tree()
  3. 7 simplemenu.module \simplemenu_menu_tree()

Custom implementation of menu_tree(). We want to retrieve the entire menu structure for a given menu, regardless of whether or not the menu item is expanded or not.

2 calls to simplemenu_menu_tree()
simplemenu_get_menu in ./simplemenu.module
Render an HTML list of links for a given menu.
simplemenu_theme_menu_tree in ./simplemenu.module
Custom implementation of theme_menu_tree() to call our custom menu above.

File

./simplemenu.module, line 188
Creates a simplemenu.

Code

function simplemenu_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) {
      $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, simplemenu_theme_menu_tree($mid), count($children) == 0);
    }
  }
  return $output;
}