function _site_map_menu_tree_output in Site map 6.2
Same name and namespace in other branches
- 7 site_map.module \_site_map_menu_tree_output()
Returns a rendered menu tree.
This is a clone of the core menu_tree_output() function with the exception of theme('site_map_menu_tree') for theming override reasons.
Parameters
array $tree: A data structure representing the tree as returned from menu_tree_data.
Return value
string The rendered HTML of that data structure.
2 calls to _site_map_menu_tree_output()
- _site_map_books in ./site_map.module 
- Render books.
- _site_map_menus in ./site_map.module 
- Render menus.
File
- ./site_map.module, line 462 
- site_map.module
Code
function _site_map_menu_tree_output($tree) {
  $output = '';
  $items = array();
  // Pull out just the menu items we are going to render so that we
  // get an accurate count for the first/last classes.
  foreach ($tree as $data) {
    if (!$data['link']['hidden']) {
      $items[] = $data;
    }
  }
  $num_items = count($items);
  foreach ($items as $i => $data) {
    $extra_class = array();
    if ($i == 0) {
      $extra_class[] = 'first';
    }
    if ($i == $num_items - 1) {
      $extra_class[] = 'last';
    }
    $extra_class = implode(' ', $extra_class);
    $link = theme('menu_item_link', $data['link']);
    if ($data['below']) {
      $output .= theme('site_map_menu_item', $link, $data['link']['has_children'], _site_map_menu_tree_output($data['below']), $data['link']['in_active_trail'], $extra_class);
    }
    else {
      $output .= theme('site_map_menu_item', $link, $data['link']['has_children'], '', $data['link']['in_active_trail'], $extra_class);
    }
  }
  return $output ? theme('site_map_menu_tree', $output) : '';
}