Skip to content
Snippets Groups Projects
Unverified Commit cbcc2fa5 authored by Michael Große's avatar Michael Große
Browse files

feat(search): add origin page as parameter

There are several use cases in which knowing the page where a search
request originated would be useful. This commit adds a `from` parameter
which provides that information.
parent 3c7a3327
No related branches found
No related tags found
No related merge requests found
......@@ -63,10 +63,11 @@ class Search extends Ui
*/
protected function getSearchFormHTML($query)
{
global $lang;
global $lang, $ID;
$searchForm = (new Form())->attrs(['method' => 'get'])->addClass('search-results-form');
$searchForm->setHiddenField('do', 'search');
$searchForm->setHiddenField('from', $ID);
$searchForm->addFieldsetOpen()->addClass('search-results-form__fieldset');
$searchForm->addTextInput('id')->val($query);
$searchForm->addButton('', $lang['btn_search'])->attr('type', 'submit');
......
......@@ -656,6 +656,7 @@ function tpl_searchform($ajax = true, $autocomplete = true) {
global $lang;
global $ACT;
global $QUERY;
global $ID;
// don't print the search form if search action has been disabled
if(!actionOK('search')) return false;
......@@ -668,6 +669,7 @@ function tpl_searchform($ajax = true, $autocomplete = true) {
'id' => 'dw__search',
]);
$searchForm->setHiddenField('do', 'search');
$searchForm->setHiddenField('from', $ID);
$searchForm->addTextInput('id')
->addClass('edit')
->attrs([
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment