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

EventDispatcherInjector.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\MVC\Symfony\View\ParametersInjector;
8
9 use eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewParametersEvent;
10 use eZ\Publish\Core\MVC\Symfony\View\ViewEvents;
11 use eZ\Publish\Core\MVC\Symfony\View\ParametersInjector;
12 use eZ\Publish\Core\MVC\Symfony\View\View;
13 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
14
18 class EventDispatcherInjector implements ParametersInjector
19 {
21 private $eventDispatcher;
22
23 public function __construct(EventDispatcherInterface $eventDispatcher)
24 {
25 $this->eventDispatcher = $eventDispatcher;
26 }
27
28 public function injectViewParameters(View $view, array $parameters)
29 {
30 $event = new FilterViewParametersEvent($view, $parameters);
31 $this->eventDispatcher->dispatch(ViewEvents::FILTER_VIEW_PARAMETERS, $event);
32 $view->addParameters($event->getViewParameters());
33 }
34 }
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\ParametersInjector\EventDispatcherInjector
Injects into a View parameters that were collected via the EventDispatcher.
Definition: EventDispatcherInjector.php:19
eZ\Publish\Core\MVC\Symfony\View\ParametersInjector\EventDispatcherInjector\$eventDispatcher
$eventDispatcher
Definition: EventDispatcherInjector.php:21
eZ\Publish\Core\MVC\Symfony\View\ParametersInjector\EventDispatcherInjector\__construct
__construct(EventDispatcherInterface $eventDispatcher)
Definition: EventDispatcherInjector.php:23
eZ\Publish\Core\MVC\Symfony\View\ParametersInjector\EventDispatcherInjector\injectViewParameters
injectViewParameters(View $view, array $parameters)
Definition: EventDispatcherInjector.php:28
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
Collects parameters that will be injected into View objects.
Definition: ParametersInjector.php:13
eZ\Publish\Core\MVC\Symfony\View\View
Main interface for Views of Value objects (content, block...).
Definition: Publish/Core/MVC/Symfony/View/View.php:16
eZ\Publish\Core\MVC\Symfony\View\View\addParameters
addParameters(array $parameters)
Adds a hash of parameters to the existing parameters.
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.