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

feat(Search): Add search form on results page

Add the search form on the results page itself. This form will be used
to add more options to refine the search further.
parent 21fcef82
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
namespace dokuwiki\Ui; namespace dokuwiki\Ui;
use \dokuwiki\Form\Form;
class Search extends Ui class Search extends Ui
{ {
protected $query; protected $query;
...@@ -38,6 +40,8 @@ class Search extends Ui ...@@ -38,6 +40,8 @@ class Search extends Ui
{ {
$searchHTML = ''; $searchHTML = '';
$searchHTML .= $this->getSearchFormHTML($this->query);
$searchHTML .= $this->getSearchIntroHTML($this->query); $searchHTML .= $this->getSearchIntroHTML($this->query);
$searchHTML .= $this->getPageLookupHTML($this->pageLookupResults); $searchHTML .= $this->getPageLookupHTML($this->pageLookupResults);
...@@ -47,6 +51,28 @@ class Search extends Ui ...@@ -47,6 +51,28 @@ class Search extends Ui
echo $searchHTML; echo $searchHTML;
} }
/**
* Get a form which can be used to adjust/refine the search
*
* @param string $query
*
* @return string
*/
protected function getSearchFormHTML($query)
{
global $lang;
$searchForm = (new Form())->attrs(['method' => 'get']);
$searchForm->setHiddenField('do', 'search');
$searchForm->addFieldsetOpen();
$searchForm->addTextInput('id', '')->val($query);
$searchForm->addButton('', $lang['btn_search'])->attr('type', 'submit');
$searchForm->addFieldsetClose();
return $searchForm->toHTML();
}
/** /**
* Build the intro text for the search page * Build the intro text for the search page
* *
...@@ -69,7 +95,6 @@ class Search extends Ui ...@@ -69,7 +95,6 @@ class Search extends Ui
return $intro; return $intro;
} }
/** /**
* Build HTML for a list of pages with matching pagenames * Build HTML for a list of pages with matching pagenames
* *
......
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