Problem/Motivation
The search result page has a search form with a search input field whose value is normally set to whatever keyword(s) was searched for. This is helpful as it provides a reminder of what was searched for and allows you to easy alter the search if necessary.
However, this does not work correctly for multi-language sites. If a search is performed from a non-default language, the search field is not set to the keyword(s) of the current search.
Steps to reproduce
1. Configure a site with multiple languages (i.e. English as default language and Spanish as additional langauge)
2. Configure a search api page at the path /search and uncheck the "Use clean URL's" checkbox
3. An English search for "widgets" will render on /search?keys=widgets and "widgets" will be the default value in the search input field on that page.
4. A Spanish search for "widgets" will render on /es/search?keys=widgets but "widgets" will not be the default value in the search input field on that page.
Proposed resolution
Update src/Form/SearchApiPageBlockForm.php to account for an optional language code in the URL when setting the default value of the search input form field.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | search_form_input_value-3189612-3.patch | 674 bytes | richarddavies |
Issue fork search_api_page-3189612
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
Comment #2
richarddavies commentedComment #3
richarddavies commentedThere may be a better solution, but this seems to fix the problem for me.
Comment #7
karlshea