Download & Extend

Show number of nodes after each term

Project:Better Exposed Filters
Version:6.x-2.0-beta1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

This patch will allow users to show the number of nodes after each term, in parenthesis, like this: "Term A (4), Term B (10)", etc. It will add a new check-box option 'Show term node count' under 'Configure filter' options.

This patch is against the 6.x-2.0-beta1 version.

AttachmentSizeStatusTest resultOperations
better_exposed_filters.patch2.83 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch better_exposed_filters_1.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details | Re-test

Comments

#1

Status:needs review» needs work

The last submitted patch, better_exposed_filters.patch, failed testing.

#2

Patch with 'diff --git' in stead 'diff -ruN'.

AttachmentSizeStatusTest resultOperations
better_exposed_filters_V2.patch2.84 KBIgnored: Check issue status.NoneNone

#3

Status:needs work» patch (to be ported)

Brilliant! Thanks for the patch!

Committed with a small change to limit this feature to Taxonomy-based filters.

(FYI: the test-bot was barfing on your patch because of trailing whitespace that Git doesn't like.)

#4

Ported to BEF 6.x-3.x. Also added term counts to radio buttons, both for D6. Still needs D7 port.

#5

Status:patch (to be ported)» needs work

Turns out that taxonomy_term_count_nodes has been removed from the D7 API. See the discussions related to this:

#602240: Re-add taxonomy_term_count_nodes()
http://drupal.org/update/modules/6/7#taxonomy_node

And a possible solution: #603868: Rework Term Node Count for D7.

So this will remain a D6-only feature. And I should point out that it only works accurately if there are no other filters applied because it simply does a database lookup and does not include the current exposed filters.

I need to add text to the option describing its limitations, leaving as "needs work" until I do.

#6

You're welcome, I am glad my patch made it into the module! Thanks for also adding term counts to radio buttons. Where was the trailing white-space(s), just in case I submit another patch in the future?

Too bad that taxonomy_term_count_nodes is not included in the D7 API, let's hope it gets included eventually. Until that happens, a temporary solution might be to copy the taxonomy_term_count_nodes function from D6, upgrade it to D7 and include it in the BEF module?

#7

Where was the trailing white-space(s), just in case I submit another patch in the future?

I don't know, actually, that's just what Git was complaining about. You might check to see if your code editor has an option to remove trailing whitespace on save...

Until that happens, a temporary solution might be to copy the taxonomy_term_count_nodes function from D6, upgrade it to D7 and include it in the BEF module?

My concern is that folks will think this is a poor man's faceted search option, which it isn't since it doesn't reflect the settings of the other filters, just the node count of the term from the database. And I don't want to start adding additional search options to BEF. I figure that Views does a far better job of that than I!

#8

Is this functionality going to be available for D7?

nobody click here