Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

ValidItems.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\MVC\Symfony\View\ParametersInjector\Block;
8
9 use eZ\Publish\Core\FieldType\Page\PageService;
10 use eZ\Publish\Core\MVC\Symfony\View\BlockView;
11 use eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewParametersEvent;
12 use eZ\Publish\Core\MVC\Symfony\View\ViewEvents;
13 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
14
18 class ValidItems implements EventSubscriberInterface
19 {
21 protected $pageService;
22
23 public function __construct(PageService $pageService)
24 {
25 $this->pageService = $pageService;
26 }
27
28 public static function getSubscribedEvents()
29 {
30 return [ViewEvents::FILTER_VIEW_PARAMETERS => 'injectValidItems'];
31 }
32
33 public function injectValidItems(FilterViewParametersEvent $event)
34 {
35 $view = $event->getView();
36 if ($view instanceof BlockView) {
37 $event->getParameterBag()->set(
38 'valid_items',
39 $this->pageService->getValidBlockItems($view->getBlock())
40 );
41 }
42 }
43 }
eZ\Publish\Core\FieldType\Page\PageService
Definition: Publish/Core/FieldType/Page/PageService.php:18
eZ\Publish\Core\MVC\Symfony\View\BlockView
Definition: Publish/Core/MVC/Symfony/View/BlockView.php:12
eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewParametersEvent
Dispatched when the parameters injected into a view are collected.
Definition: FilterViewParametersEvent.php:19
eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewParametersEvent\getView
getView()
Returns the copy of the View object.
Definition: FilterViewParametersEvent.php:83
eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewParametersEvent\getParameterBag
getParameterBag()
Returns the ParameterBag used to manipulate the view parameters.
Definition: FilterViewParametersEvent.php:73
eZ\Publish\Core\MVC\Symfony\View\ParametersInjector\Block\ValidItems
Injects valid items into the block view.
Definition: ValidItems.php:19
eZ\Publish\Core\MVC\Symfony\View\ParametersInjector\Block\ValidItems\$pageService
$pageService
Definition: ValidItems.php:21
eZ\Publish\Core\MVC\Symfony\View\ParametersInjector\Block\ValidItems\injectValidItems
injectValidItems(FilterViewParametersEvent $event)
Definition: ValidItems.php:33
eZ\Publish\Core\MVC\Symfony\View\ParametersInjector\Block\ValidItems\getSubscribedEvents
static getSubscribedEvents()
Definition: ValidItems.php:28
eZ\Publish\Core\MVC\Symfony\View\ParametersInjector\Block\ValidItems\__construct
__construct(PageService $pageService)
Definition: ValidItems.php:23
eZ\Publish\Core\MVC\Symfony\View\ViewEvents
Events constants of views.
Definition: ViewEvents.php:13
eZ\Publish\Core\MVC\Symfony\View\ViewEvents\FILTER_VIEW_PARAMETERS
const FILTER_VIEW_PARAMETERS
Dispatched before ViewParameters are injected into a View to collect the view parameters.
Definition: ViewEvents.php:30
eZ\Publish\Core\MVC\Symfony\View\ParametersInjector\Block
Definition: ValidItems.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.