I discovered a bug in the handler for taxonomy term filters. Translated term reference filters are not handled the same as default, non-translated filters. The bug manifests itself as follows:
1, In a node view, add Term Reference field filter. Choose the default, non-translated field.
2. Expose the filter.
3. Select a few of the terms, and check Allow multiple selections and Limit list to selected items.
4. In your exposed filter form, the terms you have chosen are shown, and none are selected by default. This is the correct behaviour.

Now, follow the same steps again, but this time use the translated version of the term reference field. In the exposed filter form all of the terms are selected by default, so the view results are limited unless you uncheck the terms.

The code in i18nviews_handler_filter_taxonomy_index_tid.inc in at fault. If you compare it to views_handler_filter_term_node_tid.inc it turns out that some time in the past the Views code changed. The single option disappeared and was replaced by multiple. And optional disappeared and was replaced by required.

I've created a patch that fixes the bug, and will attach it below.

Members fund testing for the Drupal project. Drupal Association Learn more


Peacog’s picture

Status: Active » Needs review
1.25 KB

Here's the patch.

johnnyfofo’s picture

This works great for me; thanks for saving me big time! To commit!

moonray’s picture

Status: Needs review » Reviewed & tested by the community

This fixes the issue for me.

sgabe’s picture

I can confirm that the patch applies fine and solves the issue.

webflo’s picture

Issue summary: View changes

Since Views uses entity_label (introduced in #1651726: Use entity_label instead of term name for term reference exposed filters) i thinks its the best approach to remove the most code in i18nviews_handler_filter_taxonomy_index_tid and only overwrite autocomplete path.

webflo’s picture

This removes a lot of code duplication and we are always in sync with views HEAD.

webflo’s picture

Status: Reviewed & tested by the community » Needs review
giufog’s picture

Ciao a tutti, io ho una tassonomia gerarchica, se utilizzo questo mudulo la tassonomia viene visualizzata correttamente ma perdo optogroup

rv0’s picture

Status: Needs review » Needs work


your patch breaks "Content: Has taxonomy terms (with depth, translated) " => selectlist is not shown