Problem/Motivation
When selecting "Hide filter, if no options" and there are no more filters to hide, the "Apply" button still shows up on the page.
Steps to reproduce
1. Add an exposed filter that uses Better Exposed Filters - tags is a good option here.
2. Make sure in the Settings for the exposed filter that the filter options are set to: "Show only used items", and "Hide filter, if no options" are set.
3. This bug shows even with only one filter added, but also shows if multiple filters are added as well.
4. Make sure that any content matching the view does not have any of the tags (or whatever taxonomy term you used) on the nodes.
5. Verify that the filter itself is hidden, but the "Apply" button still shows up.
Proposed resolution
I've got a MR/patch in the works that fixes this, but don't know if my fix is the best way to approach this so I would love a review and feedback on it.
Essentially, when the check is made in the existing code and the $element['#access'] = FALSE
, some additional code will also check to see if all elements are "hidden" and if so, also set the form access to false.
Remaining tasks
Review forthcoming patch.
User interface changes
None.
API changes
None.
Data model changes
None - except the code in my patch does add an additional "temporary" key to each element in the exposedFormAlter
that is used in checking if the element was hidden by selective better exposed filters.