Controller: Drop method createFilterControl()

This commit is contained in:
Johannes Meyer 2020-11-03 09:45:31 +01:00
parent 0293a2c721
commit febdae2552

View file

@ -12,7 +12,6 @@ use Icinga\Module\Icingadb\Common\Database;
use Icinga\Module\Icingadb\Compat\MonitoringRestrictions;
use Icinga\Module\Icingadb\Compat\UrlMigrator;
use Icinga\Module\Icingadb\Widget\BaseItemList;
use Icinga\Module\Icingadb\Widget\FilterControl;
use Icinga\Module\Icingadb\Widget\ViewModeSwitcher;
use InvalidArgumentException;
use ipl\Html\Html;
@ -229,42 +228,6 @@ class Controller extends CompatController
return $searchBar;
}
/**
* Create and return the FilterControl
*
* @param Query $query
* @param array $preserveParams
*
* @return FilterControl
*/
public function createFilterControl(Query $query, array $preserveParams = null)
{
$request = clone $this->getRequest();
$params = clone $this->params;
if (! empty($preserveParams)) {
foreach ($preserveParams as $param) {
if (! $params->has($param) && ($value = $request->getUrl()->getParam($param)) !== null) {
$params->set($param, $value);
}
}
}
$request->getUrl()->setParams($params);
$filterControl = new FilterControl($query, $preserveParams);
$filterControl->handleRequest($request);
// We're cloning the params, the editor does it, so we have to shift these ourselves
$this->params->shift('addFilter');
$this->params->shift('removeFilter');
$this->params->shift('stripFilter');
$this->params->shift('modifyFilter');
$this->params->shift('q');
return $filterControl;
}
/**
* Create and return the ViewModeSwitcher
*