--- taxonomy_menu.orig Wed Jan 5 19:19:10 2005
+++ taxonomy_menu.module Wed Jan 5 19:11:01 2005
@@ -76,14 +76,24 @@
if (arg(2)) {
$arguments = explode('/', $_GET['q']);
$main_tid = check_query(array_pop($arguments));
+ drupal_set_html_head('');
+ $result = taxonomy_select_nodes(array($main_tid), 'or', variable_get('taxonomy_menu_display_descendants', 1) ? 'all' : 0);
}
else {
- $main_tid = 0;
- }
+ // if no arg(2), we're looking at just the vid. if display_descendants
+ // is on, grab all vid tids regardless of depth. if off, grab depth=0s.
+ $tree = taxonomy_get_tree(arg(1));
+ $descendants = variable_get('taxonomy_menu_display_descendants', 1);
+ foreach ($tree as $term) {
+ if (!$descendants && $term->depth != 0) { continue; }
+ $tids[] = $term->tid;
+ }
- drupal_set_html_head('');
+ // always 0 on descendants cos our $tids would
+ // contain only vid tids we care about (above).
+ $result = taxonomy_select_nodes($tids, 'or', 0);
+ }
- $result = taxonomy_select_nodes(array($main_tid), 'or', variable_get('taxonomy_menu_display_descendants', 1) ? 'all' : 0);
print theme('page', taxonomy_render_nodes($result));
}