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.
I use Global Filter with a field: it's a field-type: list_boolean with the widget-type: options_onoff.
I have the default value added in the block under "Global Filter Defaults". It all works fine, when I select the radiobuttons they work as should be, except for one thing: in a new session (say, in incognito modus of a browser), it starts to default "all", instead of with my setting of a filtered value.
Comments
Comment #1
flbr CreditAttribution: flbr commentedI think I know why this is happening. After installing you have two global filter blocks. I used the second one, after experimenting with the first one. After that I disabled the first one in the block configuration and removed the field that was used with this first global filter block because it was a test and I didn't need it anymore. Now, suddenly, the remaining second global filter block didn't use the correct default value.
What I did: I set the "Maximum number of global filter blocks you may need" to 1 and configured the first block so it could be used on the site. (I ran into a bug here, because the second block should be disabled in the block config FIRST, before lowering the number of filter blocks from 2 to 1, otherwise the second block still "exists" in the active region of the block config.)
Now it works with 1 global filter block and the default value gets set every time.
In short: if you use only one filter, use the first global filter block, or just set it to 1 in the admin/config/content/global_filter config and use the first and only 1 block.
Comment #2
RdeBoerHi @flbr,
Thank you for your query and for answering it yourself!
Looks like you found an operational foible with Views Global Filter and an effective workaround.
Thanks for sharing.
Rik
Comment #3
RdeBoer