Problem/Motivation
When you're adding the simple search form block to, e.g., a Canvas page, you may not know, off the top of your head, what the action URL and get parameter should be. Looking those up is not something new Drupal users will know how to do.
Proposed resolution
In keeping Simple Search Form simple, we should preselect the get parameter if possible.
I propose that we do this in SimpleSearchFormBlock::defaultConfiguration():
- If Views is enabled, load the first view that has the
simple_search_form tag.
- In that view, find the first exposed
search_api_fulltext filter.
- That filter's identifier should be used as the get parameter.
Remaining tasks
Get maintainer buy-in and implement it with tests.
Comments
Comment #2
phenaproximaYou can see a shim implementation of this over in #3551702: Configure simple search form component with correct defaults.
Comment #4
phenaproximaComment #5
a.dmitriiev commentedThank you @phenaproxima for all the improvements. This feature will definitely make the user experience better. I have just one small concern, please check MR comments.
Comment #6
phenaproximaThank you @a.dmitriiev, those are great points. Tried to implement that and update the test coverage accordingly.
Comment #7
a.dmitriiev commentedCould you please check the failed test? Something with the page path
Comment #8
phenaproximaOops! Forgot that CI runs all tests in a subdirectory.
Comment #10
a.dmitriiev commentedThank you! Merged, releasing 8.x-1.9
Comment #12
pameeela commented@phenaproxima are you able to document the expected behaviour with this update? I tried to test by applying the search recipe and then adding the form to a page, but there were no defaults set from what I can see.