diff --git a/src/Block/AdminSearchBlockService.php b/src/Block/AdminSearchBlockService.php index a911115d4da..e939d244b20 100644 --- a/src/Block/AdminSearchBlockService.php +++ b/src/Block/AdminSearchBlockService.php @@ -15,6 +15,7 @@ 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; @@ -166,12 +167,17 @@ 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, + '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 8e8dec7b4b5..1dba784b247 100644 --- a/src/Resources/public/css/layout.css +++ b/src/Resources/public/css/layout.css @@ -355,6 +355,16 @@ body.fixed .content-header .navbar.stuck { word-wrap: break-word; } +.sonata-search-result-list .box .nav-stacked > li.item > span.matches { + position: relative; + display: block; + padding: 10px 15px; +} + +.sonata-search-result-list .box .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 b9a90e26898..94bf6cff255 100644 --- a/src/Resources/views/Block/block_search_result.html.twig +++ b/src/Resources/views/Block/block_search_result.html.twig @@ -52,11 +52,26 @@ file that was distributed with this source code. {% if results_count > 0 %}
-