Index: sites/all/modules/site_map/site_map.module
===================================================================
--- sites/all/modules/site_map/site_map.module (revision 4101)
+++ sites/all/modules/site_map/site_map.module (working copy)
@@ -123,7 +123,14 @@
'#maxlength' => 10,
'#description' => t('Specify how many subcategories should be included on the categorie page. Enter "all" to include all subcategories,"0" to include no subcategories, or "-1" not to append the depth at all.'),
);
-
+ $form['site_map_content_options']['site_map_count_threshold'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Tag node count threshold'),
+ '#default_value' => variable_get('site_map_count_threshold', -1),
+ '#size' => 3,
+ '#description' => t('Only show tags whose node counts are greater than this threshold. Set to -1 to disable')
+ );
+
$form['site_map_rss_options'] = array(
'#type' => 'fieldset',
'#title' => t('RSS settings'),
@@ -379,10 +386,10 @@
*/
function _site_map_taxonomys() {
if (module_exists('taxonomy') && $vids = variable_get('site_map_show_vocabularies', array())) {
- $result = db_query('SELECT vid, name, description
+ $result = db_query('SELECT vid, name, description, tags
FROM {vocabulary} WHERE vid IN (%s) ORDER BY weight ASC, name', implode(',', $vids));
while ($t = db_fetch_object($result)) {
- $output .= _site_map_taxonomy_tree($t->vid, $t->name, $t->description);
+ $output .= _site_map_taxonomy_tree($t->vid, $t->name, $t->description, $t->tags);
}
}
@@ -397,7 +404,7 @@
* @param $description An optional description of the tree. (Default: NULL)
* @return A string representing a rendered tree.
*/
-function _site_map_taxonomy_tree($vid, $name = NULL, $description = NULL) {
+function _site_map_taxonomy_tree($vid, $name = NULL, $description = NULL, $tags = 0) {
if ($vid == variable_get('forum_nav_vocabulary', '')) {
$title = l($name, 'forum');
}
@@ -421,46 +428,55 @@
$output .= '
';
// taxonomy_get_tree() honors access controls
$tree = taxonomy_get_tree($vid);
+
+ if ($tags) {
+ $threshold_count = variable_get('site_map_count_threshold', -1);
+ }
+ else {
+ $threshold_count = -1;
+ }
foreach ($tree as $term) {
// Adjust the depth of the
based on the change
// in $term->depth since the $last_depth.
- if ($term->depth > $last_depth) {
- for ($i = 0; $i < ($term->depth - $last_depth); $i++) {
- $output .= '';
+ $term->count = taxonomy_term_count_nodes($term->tid);
+ if ($term->count > $threshold_count) {
+ if ($term->depth > $last_depth) {
+ for ($i = 0; $i < ($term->depth - $last_depth); $i++) {
+ $output .= '';
+ }
}
- }
- else if ($term->depth < $last_depth) {
- for ($i = 0; $i < ($last_depth - $term->depth); $i++) {
- $output .= '
';
+ else if ($term->depth < $last_depth) {
+ for ($i = 0; $i < ($last_depth - $term->depth); $i++) {
+ $output .= '
';
+ }
}
- }
- // Display the $term.
- $output .= '- ';
- $term->count = taxonomy_term_count_nodes($term->tid);
- if ($term->count) {
- if ($cat_depth < 0) {
- $output .= l($term->name, taxonomy_term_path($term), array('title' => $term->description));
+
+ // Display the $term.
+ $output .= '
- ';
+
+ if ($term->count) {
+ if ($cat_depth < 0) {
+ $output .= l($term->name, taxonomy_term_path($term), array('title' => $term->description));
+ }
+ else {
+ $output .= l($term->name, "taxonomy/term/$term->tid/$cat_depth", array('title' => $term->description));
+ }
}
else {
- $output .= l($term->name, "taxonomy/term/$term->tid/$cat_depth", array('title' => $term->description));
+ $output .= check_plain($term->name);
}
- }
- else {
- $output .= check_plain($term->name);
- }
- if (variable_get('site_map_show_count', 1)) {
- $output .= " ($term->count)";
+ if (variable_get('site_map_show_count', 1)) {
+ $output .= " ($term->count)";
+ }
+ if (variable_get('site_map_show_rss_links', 1)) {
+ $output .= ' '. theme('site_map_feed_icon', url("taxonomy/term/$term->tid/$rss_depth/feed"));
+ $output .= (module_exists('commentrss') ? ' '. theme('site_map_feed_icon', url("crss/term/$term->tid"), 'comment') : '');
+ }
+
+ $output .= "
\n";
+ // Reset $last_depth in preparation for the next $term.
+ $last_depth = $term->depth;
}
- if (variable_get('site_map_show_rss_links', 1)) {
- $output .= ' '. theme('site_map_feed_icon', url("taxonomy/term/$term->tid/$rss_depth/feed"));
- $output .= (module_exists('commentrss') ? ' '. theme('site_map_feed_icon', url("crss/term/$term->tid"), 'comment') : '');
- }
-
-
-
- $output .= "\n";
- // Reset $last_depth in preparation for the next $term.
- $last_depth = $term->depth;
}
// Bring the depth back to where it began, -1.