From 10cbb68bf3ce617ed1130ffb7de521146b7b0fc5 Mon Sep 17 00:00:00 2001 From: core23 Date: Mon, 9 Aug 2021 21:49:19 +0200 Subject: [PATCH] Revert: Show matching filters in search results --- src/Block/AdminSearchBlockService.php | 11 +------- src/Resources/public/css/layout.css | 10 ------- .../views/Block/block_search_result.html.twig | 28 ++----------------- 3 files changed, 3 insertions(+), 46 deletions(-) diff --git a/src/Block/AdminSearchBlockService.php b/src/Block/AdminSearchBlockService.php index 60d99ff38b..ca93237897 100644 --- a/src/Block/AdminSearchBlockService.php +++ b/src/Block/AdminSearchBlockService.php @@ -15,7 +15,6 @@ use Sonata\AdminBundle\Admin\AdminInterface; use Sonata\AdminBundle\Admin\Pool; -use Sonata\AdminBundle\Filter\FilterInterface; use Sonata\AdminBundle\Search\SearchHandler; use Sonata\BlockBundle\Block\BlockContextInterface; use Sonata\BlockBundle\Block\Service\AbstractBlockService; @@ -154,11 +153,9 @@ public function execute(BlockContextInterface $blockContext, ?Response $response $admin->checkAccess('list'); - $term = $blockContext->getSetting('query'); - $pager = $this->searchHandler->search( $admin, - $term, + $blockContext->getSetting('query'), $blockContext->getSetting('page'), $blockContext->getSetting('per_page') ); @@ -169,18 +166,12 @@ public function execute(BlockContextInterface $blockContext, ?Response $response return $response->setContent('')->setStatusCode(204); } - $filters = array_filter($admin->getDatagrid()->getFilters(), static function (FilterInterface $filter): bool { - return $filter->isActive(); - }); - return $this->renderPrivateResponse($admin->getTemplate('search_result_block'), [ 'block' => $blockContext->getBlock(), 'settings' => $blockContext->getSettings(), // NEXT_MAJOR: Remove next line. 'admin_pool' => $this->pool, 'pager' => $pager, - 'term' => $term, - 'filters' => $filters, 'admin' => $admin, 'show_empty_boxes' => $this->emptyBoxesOption, ], $response); diff --git a/src/Resources/public/css/layout.css b/src/Resources/public/css/layout.css index 98988eb54d..8e8dec7b4b 100644 --- a/src/Resources/public/css/layout.css +++ b/src/Resources/public/css/layout.css @@ -355,16 +355,6 @@ body.fixed .content-header .navbar.stuck { word-wrap: break-word; } -.sonata-search-result-list.nav-stacked > li.item > span.matches { - position: relative; - display: block; - padding: 10px 15px; -} - -.sonata-search-result-list.nav-stacked > li.item > span.matches > a.label { - margin: 0 1px; -} - .form-actions.stuck { position:fixed; bottom:0; diff --git a/src/Resources/views/Block/block_search_result.html.twig b/src/Resources/views/Block/block_search_result.html.twig index 1efbb2826a..b671f265ec 100644 --- a/src/Resources/views/Block/block_search_result.html.twig +++ b/src/Resources/views/Block/block_search_result.html.twig @@ -52,35 +52,11 @@ file that was distributed with this source code. {% if results_count > 0 %}
-