[COMPONENTS][Search] Polished template

[COMPONENTS][Search] Fix event typo
This commit is contained in:
2021-12-02 16:37:17 +00:00
parent 5cd96669fd
commit f35dbbd8c1
3 changed files with 41 additions and 18 deletions

View File

@@ -41,12 +41,13 @@ class Search extends Component
/**
* Add the search form to the site header
* @throws RedirectException
*/
public function onAddExtraHeaderForms(Request $request, array &$elements)
{
$form = Form::create([
['query', TextType::class, [
'attr' => ['placeholder' => _m('Search tags...')],
['search_tags', TextType::class, [
'attr' => ['placeholder' => _m('Input desired query...')],
]],
[$form_name = 'submit_search', SubmitType::class,
[
@@ -63,7 +64,7 @@ class Search extends Component
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
throw new RedirectException('search', ['q' => $data['query']]);
throw new RedirectException('search', ['q' => $data['search_tags']]);
}
}