Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
That's about it what I wrote in the title. Happens in situation where BEF and Views Selective Exposed Filters are working together, and VSEF returns an empty set of filters.
Asking for advice here as I didn't delved into the issue myself yet.
Comment | File | Size | Author |
---|---|---|---|
#1 | BEF_returns_an_empty_select_window_when_no_options_are_present-2057815-1.patch | 809 bytes | d.clarke |
Comments
Comment #1
d.clarke CreditAttribution: d.clarke commentedIf I understand this issue correctly, you are saying that if you have an exposed filter that provides a drop down list of options and then you change it in the "BEF Settings" to be displayed as "Checkboxes/Radio Buttons" if there are no options available for that filter, the filter will be displayed in its default state... an empty drop down.
If this a correct understanding of the reported issue, this issue occurs in better_exposed_filters_exposed_form_plugin.inc on line 936. If the options array is empty the display will be reset back to the default format. This was part of commit 93d27e39 which was a fix for ticket #1912684: Error in line 752 and 752 of better_exposed_filters_exposed_form_plugin.inc. I think it was intended to handle cases where the filter is an auto-complete filter but BEF was trying to convert it to a drop down or radio/checkbox list. Since it was an autocomplete, there were no #options and as a result it was causing errors. The patch checked if the #options was empty() but that accidentally includes the scenario documented in this ticket where the #options array is set but it is set to null or an empty array.
Attached is a patch that I think will address both cases. By changing it from an empty() check to an array_key_exists() it should handle both cases.
Comment #2
d.clarke CreditAttribution: d.clarke commentedComment #3
mikeker CreditAttribution: mikeker commentedThanks!
It's been committed.
Comment #4
mikeker CreditAttribution: mikeker commented