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

BlockValidContentInfoItemsListener.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishCoreBundle\EventListener;
8
9 use eZ\Publish\Core\FieldType\Page\PageService;
10 use eZ\Bundle\EzPublishCoreBundle\FieldType\Page\PageService as CoreBundlePageService;
11 use eZ\Publish\Core\MVC\Symfony\View\BlockView;
12 use eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewParametersEvent;
13 use eZ\Publish\Core\MVC\Symfony\View\ViewEvents;
14 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15
19 class BlockValidContentInfoItemsListener implements EventSubscriberInterface
20 {
22 protected $pageService;
23
24 public function __construct(PageService $pageService)
25 {
26 $this->pageService = $pageService;
27 }
28
29 public static function getSubscribedEvents()
30 {
31 return [ViewEvents::FILTER_VIEW_PARAMETERS => 'injectValidContentInfoItems'];
32 }
33
34 public function injectValidContentInfoItems(FilterViewParametersEvent $event)
35 {
36 $view = $event->getView();
37 if ($view instanceof BlockView && $this->pageService instanceof CoreBundlePageService) {
38 $event->getParameterBag()->set(
39 'valid_contentinfo_items',
40 $this->pageService->getValidBlockItemsAsContentInfo($view->getBlock())
41 );
42 }
43 }
44 }
eZ\Bundle\EzPublishCoreBundle\EventListener\BlockValidContentInfoItemsListener
Injects valid ContentInfo items into the block view.
Definition: BlockValidContentInfoItemsListener.php:20
eZ\Bundle\EzPublishCoreBundle\EventListener\BlockValidContentInfoItemsListener\injectValidContentInfoItems
injectValidContentInfoItems(FilterViewParametersEvent $event)
Definition: BlockValidContentInfoItemsListener.php:34
eZ\Bundle\EzPublishCoreBundle\EventListener\BlockValidContentInfoItemsListener\getSubscribedEvents
static getSubscribedEvents()
Definition: BlockValidContentInfoItemsListener.php:29
eZ\Bundle\EzPublishCoreBundle\EventListener\BlockValidContentInfoItemsListener\__construct
__construct(PageService $pageService)
Definition: BlockValidContentInfoItemsListener.php:24
eZ\Bundle\EzPublishCoreBundle\EventListener\BlockValidContentInfoItemsListener\$pageService
$pageService
Definition: BlockValidContentInfoItemsListener.php:22
eZ\Bundle\EzPublishCoreBundle\FieldType\Page\PageService
Definition: Bundle/EzPublishCoreBundle/FieldType/Page/PageService.php:14
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\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\Bundle\EzPublishCoreBundle\EventListener
Definition: BackgroundIndexingTerminateListener.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.