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():

  1. If Views is enabled, load the first view that has the simple_search_form tag.
  2. In that view, find the first exposed search_api_fulltext filter.
  3. That filter's identifier should be used as the get parameter.

Remaining tasks

Get maintainer buy-in and implement it with tests.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

phenaproxima created an issue. See original summary.

phenaproxima’s picture

phenaproxima’s picture

Status: Active » Needs review
a.dmitriiev’s picture

Status: Needs review » Needs work

Thank 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.

phenaproxima’s picture

Status: Needs work » Needs review

Thank you @a.dmitriiev, those are great points. Tried to implement that and update the test coverage accordingly.

a.dmitriiev’s picture

Status: Needs review » Needs work

Could you please check the failed test? Something with the page path

phenaproxima’s picture

Status: Needs work » Needs review

Oops! Forgot that CI runs all tests in a subdirectory.

a.dmitriiev’s picture

Status: Needs review » Fixed

Thank you! Merged, releasing 8.x-1.9

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

pameeela’s picture

@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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.