It would be practical if the content manager could specify how many posts there must be (a minimum) in the displayed category for the taxonomy filter block to show up. It does not make much sense to show the "filter by" block if there is only 3 posts in the actual category. Then we can use that valuable block space for something else.

It would be practical if the content manager could him/herself determine the desired threshold, as it is also practical to be able to vary it temporarily for administrative purposes, so we would need to be able to set the value low sometimes too.

I would think that the values 5, 10 and 15 could be useful thresholds, or that simply offering a editable field would be ok.

Comments

styro’s picture

Hi Daniel,

Watch this space.

For nearly a month now I've been doing a massive rewrite of taxonomy_filter with lots of new features, and I'm debugging it at the moment. I intend to release a beta version into the HEAD branch (still 4.7 compatible) within a week or two. It has been a much bigger more complex job than I expected, and has delayed any efforts towards 5.0 porting (which I still plan to start as soon as I can).

Basically the new version takes care of heirarchical vocabs (including multiple hierarchies - that was tricky), configurable depth handling, how to handle empty result sets and display of the results, and contains 4 types of menu that can can be individually chosen for each vocab.

The four menus types are:
* a static nested menu list, where you have some control over how many levels to open up
* a contextual menu that shows parent/child/related terms
* a dynamic nested menu that expands to show subterms
* a tag cloud representing the number of results from each combination

We've got an early version running here:
http://knowledge.ilign.com/taxonomy/term/44,39/9 (currently using the dynamic menu type)

While I haven't got your requested threshold in there, you can tell it not to show combinations that have no results.

Also the code is getting slighty more flexible at working with more than 2 terms in the url. No promises but later on I plan to investigate adding deli.cio.us style +/- links to the interface for handling more than 2 terms at once.

styro’s picture

Status: Active » Postponed

Part of this is now implemented in 3.x. I'll just postpone the configurable threshold part of this issue for now.

Feel free to add further input.

styro’s picture

Version: 4.7.x-2.x-dev » 7.x-1.x-dev
Status: Postponed » Fixed

With the Drupal 6 version, the configurable threshold could now be implemented by a very simple addon module.

Leeteq’s picture

Ok, are you referring to a specific module that exist, like Views or other, or that someone could easily make one? If there is one that is "obvious" to use for this, it would be practical to know. Thanks for the great work :-)

styro’s picture

Hehe, I'm surprised you're still here :)

The addon module doesn't exist, but it would be very simple to write now that taxonomy_filter is an extensible framework. It's a little rough as it's my first attempt at something like that.

Take a look at the included tf_count submodule. It adds a count variable to each menu item, and also has some code showing how to throw out menu items with zero results.

If you enable the tf_count module, your addon module for a configurable threshold would only (ok "should only" hehe) have to implement hook_tf_section_alter() to unset items from the section array where the count value is below your threshold. If you are happy hardcoding the threshold (ie no admin forms etc), the entire module would only need to be a few lines of code.

eg: (untested)

<?php
function yourmodule_tf_section_alter(&$section, $block_info) {
  $threshold = 5;
  foreach ($section['items'] as $key => &$item) {
    $count = $item['info']['tf_count'];
    if ($count < $threshold) {
      unset($section['items'][$key]);
    }
  }
}
?>

The API.txt file is a little brief, but hopefully should explain things enough.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.