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.
Comment | File | Size | Author |
---|---|---|---|
#6 | i18nviews-term-reference-filter-handler-1910716-6.patch | 6.58 KB | webflo |
#1 | i18nviews-term-reference-filter-handler-1910716-1.patch | 1.25 KB | Peacog |
Comments
Comment #1
Peacog CreditAttribution: Peacog commentedHere's the patch.
Comment #2
johnnyfofo CreditAttribution: johnnyfofo commentedThis works great for me; thanks for saving me big time! To commit!
Comment #3
moonray CreditAttribution: moonray commentedThis fixes the issue for me.
Comment #4
sgabe CreditAttribution: sgabe commentedI can confirm that the patch applies fine and solves the issue.
Comment #5
webflo CreditAttribution: webflo commentedSince 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 ini18nviews_handler_filter_taxonomy_index_tid
and only overwrite autocomplete path.Comment #6
webflo CreditAttribution: webflo commentedThis removes a lot of code duplication and we are always in sync with views HEAD.
Comment #7
webflo CreditAttribution: webflo commentedComment #8
giufog CreditAttribution: giufog commentedCiao a tutti, io ho una tassonomia gerarchica, se utilizzo questo mudulo la tassonomia viene visualizzata correttamente ma perdo optogroup
Comment #9
rv0 CreditAttribution: rv0 at Coworks.be commented@webflo
your patch breaks "Content: Has taxonomy terms (with depth, translated) " => selectlist is not shown