QuickSearch: implement it as a trait

This commit is contained in:
Thomas Gelf 2017-06-13 18:33:16 +02:00
parent e0589d3560
commit bf5b7dbf32
1 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
<?php
namespace Icinga\Module\Director\Web\Controller\Extension;
use ipl\Html\Html;
trait QuickSearch
{
public function quickSearch()
{
$search = $this->params->get('q');
$form = Html::tag('form', [
'action' => $this->getRequest()->getUrl()->without(array('q', 'page', 'modifyFilter')),
'class' => ['quicksearch', 'inline'],
'method' => 'GET'
]);
$form->add(
Html::tag('input', [
'type' => 'text',
'name' => 'q',
'value' => $search,
'placeholder' => $this->translate('Search...'),
'class' => 'search'
])
);
$this->controls()->add($form);
return $search;
}
}