--- modulos/taxonomy_menu/taxonomy_menu.module +++ nuevos_modulos/taxonomy_menu/taxonomy_menu.module @@ -771,14 +771,16 @@ * @param $vid * @return boolean */ -function _taxonomy_menu_children_has_nodes($tid, $vid) { - $children = taxonomy_get_children($tid, $vid); - foreach ($children as $tid => $term) { - if (_taxonomy_menu_term_count($tid) > 0) { - return _taxonomy_menu_children_has_nodes($tid, $vid); - } - } - return TRUE; +function _taxonomy_menu_children_has_nodes($tid, $vid, $has_nodes = FALSE) { + if (!$has_nodes) { + $children = taxonomy_get_children($tid, $vid); + foreach ($children as $tid => $term) { + if (_taxonomy_menu_term_count($tid) > 0) { + return _taxonomy_menu_children_has_nodes($tid, $vid, TRUE); + } + } + } + return $has_nodes; } /** @@ -795,7 +797,7 @@ //if hide menu is selected and the term count is 0 and the term has no children then do not create the menu item if ($num == 0 && variable_get('taxonomy_menu_hide_empty_terms_'. $item['vid'], FALSE) && - _taxonomy_menu_children_has_nodes($item['tid'], $item['vid'])) { + !_taxonomy_menu_children_has_nodes($item['tid'], $item['vid'])) { $item['remove'] = TRUE; return $item; @@ -995,7 +997,7 @@ //if hide menu is selected and the term count is 0 and the term has no children then do not create the menu item if ($num == 0 && variable_get('taxonomy_menu_hide_empty_terms_'. $t['vid'], FALSE) && - _taxonomy_menu_children_has_nodes($t['tid'], $t['vid'])) { + !_taxonomy_menu_children_has_nodes($t['tid'], $t['vid'])) { $display_num = ''; } // if display number is selected and $num > 0 then change the title