Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
When using entity translation to translate terms and having them as an exposed filter in a view, terms that don't have a translation are available as options but are lacking a label in the select widget.
This happens because entity_label('taxonomy_term', $entity_term) returns null as those terms don't have a label in the current language.
This is related to the change that was introduced with #1651726: Use entity_label instead of term name for term reference exposed filters.
Proposed resolution
Check the result of entity_label('taxonomy_term', $entity_term) and only add an option if there's an actual entity label.
Comment | File | Size | Author |
---|---|---|---|
#4 | views-empty_options_in_exposed_filter-2569527-4.patch | 1.72 KB | Andrew Answer |
|
Comments
Comment #2
s_leu CreditAttribution: s_leu at MD Systems GmbH commentedHere's a patch that fixes this.
Comment #3
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 3 year old patch in #2 to views_handler_filter_term_node_tid.inc does not apply to the latest views 7.x-3.x-dev and if still relevant needs to be rerolled.
Comment #4
Andrew Answer CreditAttribution: Andrew Answer as a volunteer commentedPatch rerolled. Second hunk with $choice=stdClass() completely removed because of corresponding data structure is absent. Please review this patch.