diff -ru sitemenu/sitemenu.module sitemenu_new/sitemenu.module --- sitemenu/sitemenu.module 2007-06-01 04:38:10.000000000 +0000 +++ sitemenu_new/sitemenu.module 2007-11-03 00:55:34.000000000 +0000 @@ -114,6 +114,12 @@ '#default_value' => variable_get(SITEMENU_NODE_COUNT, 1), ); + $form[SITEMENU_HIDE_EMPTY] = array( + '#type' => 'checkbox', + '#title' => t('Hide empty terms'), + '#default_value' => variable_get(SITEMENU_HIDE_EMPTY, 1), + ); + $form[SITEMENU_CACHING] = array( '#type' => 'checkbox', '#title' => t('Cache the taxonomy tree for performance.'), @@ -260,7 +266,7 @@ if (!$tree_nodes) { $tree = taxonomy_get_tree($vocabulary->vid); $get_node_count = variable_get(SITEMENU_NODE_COUNT, 1); - if ($get_node_count && $mode == 'page') { + if ($get_node_count) { // append the node count to each term name for ($m=0; $mtid)) { @@ -430,13 +436,17 @@ } } - // if children exist, output with proper class and id attributes, else, output item with - // specified link or default link - if ($term->depth < $tree[$m+1]->depth) { - $output .= "
  • ". $link ."\n"; - } - else { - $output .= "
  • ". $link ."
  • \n"; + // If this is a node or a term with children, or if the hide_empty option is + // not selected: add the item to the list + if (isset($term->link) || $term->count || variable_get(SITEMENU_HIDE_EMPTY, 1) == false) { + // if children exist, output with proper class and id attributes, else, output item with + // specified link or default link + if ($term->depth < $tree[$m+1]->depth) { + $output .= "
  • ". $link ."\n"; + } + else { + $output .= "
  • ". $link ."
  • \n"; + } } unset($description); }