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

CustomParameters.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 Symfony\Component\EventDispatcher\EventSubscriberInterface;
12
16 class CustomParameters implements EventSubscriberInterface
17 {
18 public static function getSubscribedEvents()
19 {
20 return [ViewEvents::FILTER_VIEW_PARAMETERS => 'injectCustomParameters'];
21 }
22
23 public function injectCustomParameters(FilterViewParametersEvent $event)
24 {
25 $builderParameters = $event->getBuilderParameters();
26
27 if (isset($builderParameters['params']) && is_array($builderParameters['params'])) {
28 $customParameters = $builderParameters['params'];
29 $event->getParameterBag()->add($customParameters);
30 }
31 }
32 }
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\getParameterBag
getParameterBag()
Returns the ParameterBag used to manipulate the view parameters.
Definition: FilterViewParametersEvent.php:73
eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewParametersEvent\getBuilderParameters
getBuilderParameters()
Returns the parameters that were passed to the builder.
Definition: FilterViewParametersEvent.php:63
eZ\Publish\Core\MVC\Symfony\View\ParametersInjector\CustomParameters
Injects the contents of the 'params' array passed to the controller as view parameters.
Definition: CustomParameters.php:17
eZ\Publish\Core\MVC\Symfony\View\ParametersInjector\CustomParameters\injectCustomParameters
injectCustomParameters(FilterViewParametersEvent $event)
Definition: CustomParameters.php:23
eZ\Publish\Core\MVC\Symfony\View\ParametersInjector\CustomParameters\getSubscribedEvents
static getSubscribedEvents()
Definition: CustomParameters.php:18
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
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.