For current search blocks there is an option "Display current search block on empty search pages.", which results in the current search block always showing.
If I have a search page that allows searching on facets only I have to have that option enabled for current search to work with facet only searches.
However, I do not want the current search block displaying on the initial page load, where the user has not yet searched on facets or keywords.
Would it be possible to add an option for displaying the current search block for facet only searches but not empty search pages?
Comments
Comment #1
rooby commentedHere is a patch that changes the "Display current search block on empty search pages." checkbox to a set of radios with a number of options:
* Display only if keywords are entered.
* Display always.
* Display only if filters are present.
* Display if filters or keywords are present.
Current option values & default remain unchanged.
Comment #2
cpliakas commentedComment #3
rooby commentedNo reason?
Comment #4
rooby commentedComment #5
cpliakas commentedrooby,
My bad! That was a total accident. I was closing some other issues, and this one was accidentally got closed as well. Specifically, I have some projects that have reached "end of life" status for about a year, so I opened some of the stale issues in separate tabs and mass closed them. This one was probably open as well and I blew over it without double checking.
Re: the patch, I like it! Let me fire it up and play around with it, but it looks good to me.
Thanks,
Chris
Comment #6
cpliakas commentedHi rooby.
Patch works as advertised, so I am marking this as RTBC with a few style modifications and follow up issues. Your patch ads display settings which act on both empty and non-empty searches, which is great, but requires some modifications in the UI to reflect that. I am also going to shorten the names of the constants a bit.
Moving forward, I think it would be great to expose a series of checkboxes as well as a method to override the settings so that developers can add additional options. This will require changing the numbers to strings and adding a hook to current_search_check_visibility(). That is more of a 2.x issue since it would be really hard to maintain backwards compatibility without writing an update hook which may or may not work. Anyways, that is future stuff and I mostly wanted to catch that thought in this thread.
Excellent work, and thanks for the great feature!
Chris
Comment #7
cpliakas commentedCommitted to all versions of Facet API.
Follow-up issues posted below:
Comment #8
rooby commentedNo worries, I thought that's what might have happened :)
Thanks for the tweaks, I expected the crazy constants would need amending.