Skip to content

Commit

Permalink
IBX-2: Specified action path for search form for easier reuse
Browse files Browse the repository at this point in the history
  • Loading branch information
ViniTou committed Mar 5, 2021
1 parent dbe3852 commit 92928b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/bundle/Resources/config/services/views.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ services:
$contentTypeService: '@ezpublish.api.service.content_type'
$siteAccessGroups: '%ezpublish.siteaccess.groups%'
$innerFilter: '@EzSystems\EzPlatformAdminUi\View\Filter\AdminSearchViewFilter.inner'
$router: '@router'
tags:
- { name: kernel.event_subscriber }
9 changes: 8 additions & 1 deletion src/lib/View/Filter/AdminSearchViewFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\RouterInterface;

class AdminSearchViewFilter implements EventSubscriberInterface
{
Expand All @@ -42,20 +43,25 @@ class AdminSearchViewFilter implements EventSubscriberInterface
/** @var \Ibexa\Platform\Search\View\SearchViewFilter */
private $innerFilter;

/** @var \Symfony\Component\Routing\RouterInterface */
private $router;

public function __construct(
ConfigResolverInterface $configResolver,
FormFactoryInterface $formFactory,
SectionService $sectionService,
ContentTypeService $contentTypeService,
array $siteAccessGroups,
SearchViewFilter $innerFilter
SearchViewFilter $innerFilter,
RouterInterface $router
) {
$this->configResolver = $configResolver;
$this->formFactory = $formFactory;
$this->sectionService = $sectionService;
$this->contentTypeService = $contentTypeService;
$this->siteAccessGroups = $siteAccessGroups;
$this->innerFilter = $innerFilter;
$this->router = $router;
}

public static function getSubscribedEvents()
Expand Down Expand Up @@ -134,6 +140,7 @@ public function handleSearchForm(FilterViewBuilderParametersEvent $event): void
[
'method' => Request::METHOD_GET,
'csrf_protection' => false,
'action' => $this->router->generate('ezplatform.search')
]
);

Expand Down

0 comments on commit 92928b3

Please sign in to comment.