When using exposed filters that have default values set as "secondary options", submitting the exposed filters form results in the secondary fieldset being expanded. Similarly, if the secondary fieldset is expanded but no values are changed, the fieldset will remain open.
Instead of merely detecting for the existence of input, the input should be compared with the default values of each of the secondary filters.
I have a patch which seems to do this successfully with both single and multiple value exposed filters.
If you'll accept this feature, my question is, do you prefer to add an option to the BEF settings configuration or is this the desired behavior globally?
Attached is a feature which includes a view that provides a page at: /bef-secondary-collapse-test
The view includes both single value and multiple value exposed filters with and without default values.
The idea is that you should be able to submit the form without the secondary fieldset opening (or closing the fieldset if it was open but inputs were not changed from default).
Comments
Comment #2
lee20 CreditAttribution: lee20 as a volunteer commentedAttached is the patch.
One thing I'm not sure about is: It checks the input of exposed filters before checking whether or not it's a secondary. Shouldn't be a big deal, but it might be more ideal to check if it's secondary first, but the added method "filter_has_exposed_input" can be used generically this way.
Comment #3
lee20 CreditAttribution: lee20 as a volunteer commentedForgot to search the issue queue before submitting this. It looks like #2341807: Configure collapsed-state of secondary filters fieldset is related but that it hasn't addressed the comparison of default values.
Comment #4
junaidpvWe were looking for this and found this thread. The patch is working good for us. Thanks!
Comment #5
veroniqueg CreditAttribution: veroniqueg at Mouvement ATD Quart Monde commentedI have a few issues with patch #2, I have some select widgets with values selected with 'Limit list to selected items'
It gives me a lot of
And it detects default_value as the first value selected, and not 'All' as it should, so the secondary options is always opened
Also as you mentioned above, it will be more efficient if you test
so it computes the exposed input only if it's exposed and secondary
Here is the patch that works for me in that case
Comment #6
veroniqueg CreditAttribution: veroniqueg at Mouvement ATD Quart Monde commentedComment #7
lee20 CreditAttribution: lee20 as a volunteer commentedHere is a re-roll of the patch from #2 which addresses the array_shift() issues mentioned in #5.
I couldn't get the patch from #5 to apply with or without the patch from #2.
Still needs work to support multiple selections afaik.
Comment #8
junaidpvRe-rolled patch from comment#7 to for current release 7.x-3.6.
Comment #9
Neslee Canil PintoHi, there will be no more future development for 7.x branch. If you see this issue in 8.x, feel free to file an issue. Closing this as Closed(wont fix).