Posted by GiorgosK on February 27, 2007 at 12:42am
| Project: | SiteMenu |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Issue Summary
I tweaked the code to do just that if anybody is interested
//line 268
if ($get_node_count && $mode == 'page') {
//becomes
if ($get_node_count ) {
//and lines 439-444
if ($term->depth < $tree[$m+1]->depth) {
$output .= "<li class=\"expanded\">". $link ."\n";
}
else {
$output .= "<li class=\"leaf\">". $link ."</li>\n";
}
//become
if ($term->count) {//addition
if ($term->depth < $tree[$m+1]->depth) {
$output .= "<li class=\"expanded\">". $link ."\n";
}
else {
$output .= "<li class=\"leaf\">". $link ."</li>\n";
}
}//additionor it could also be incorporated in the code with a configuration setting of whether to display terms with no nodes
(but I am not familiar with the drupal code yet to do it)
Comments
#1
Thanks, this really helped me a lot. It would be nice if the developer built that in as a configuration setting. I'm sure we aren't the only 2 guys who have needed this. Thanks again!
#2
If someone prepares a proper tested working patch, with an optional settings, I will commit.
#3
Patch attached. Unlike the modification above it still displays the nodes. Adds an option to the settings page.
Empty vocabularies will still be shown, but I don't think this matters. You could always disable them manually in the config page.
#4
Anyone tested this?
Do you like this feature.
I am looking for input.
#5
the patch is fine for me.
but when using the Content Access module
sitemenu ignores the permissions set.
nodes hidden from anonymous roles are displayed.
#6
Strange I've just changed it as you say and what it happens it's completely the opposite;
it only display terms that do NOT have nodes associated with them
what did I do wrong?
#7
my mistake
I've found what I did wrong and it works like charm
Thanks :-)
#8
Wouldn't it be great to add this function as an option.
That's it, somewhere you can tick to choose whether to see them all or only the ones that have something in it.
#9
+1 for option to see only terms w/corresponding nodes.