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

RequestAttributes.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\MVC\Symfony\View\Builder\ParametersFilter;
8
9 use eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewBuilderParametersEvent;
10 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
11 use eZ\Publish\Core\MVC\Symfony\View\ViewEvents;
12
16 class RequestAttributes implements EventSubscriberInterface
17 {
18 public static function getSubscribedEvents()
19 {
20 return [ViewEvents::FILTER_BUILDER_PARAMETERS => 'addRequestAttributes'];
21 }
22
28 public function addRequestAttributes(FilterViewBuilderParametersEvent $e)
29 {
30 $parameterBag = $e->getParameters();
31 $parameterBag->add($e->getRequest()->attributes->all());
32
33 // maybe this should be in its own listener ? The ViewBuilder needs it.
34 if (!$parameterBag->has('viewType')) {
35 $parameterBag->add(['viewType' => null]);
36 }
37 }
38 }
eZ\Publish\Core\MVC\Symfony\View\Builder\ParametersFilter\RequestAttributes
Collects parameters for the ViewBuilder from the Request.
Definition: RequestAttributes.php:17
eZ\Publish\Core\MVC\Symfony\View\Builder\ParametersFilter\RequestAttributes\addRequestAttributes
addRequestAttributes(FilterViewBuilderParametersEvent $e)
Adds all the request attributes to the parameters.
Definition: RequestAttributes.php:28
eZ\Publish\Core\MVC\Symfony\View\Builder\ParametersFilter\RequestAttributes\getSubscribedEvents
static getSubscribedEvents()
Definition: RequestAttributes.php:18
eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewBuilderParametersEvent
An event that collects the parameters the ViewBuilder will be provided to build View objects.
Definition: FilterViewBuilderParametersEvent.php:17
eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewBuilderParametersEvent\getParameters
getParameters()
Returns the ParameterBag that holds the ViewBuilder's parameters.
Definition: FilterViewBuilderParametersEvent.php:47
eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewBuilderParametersEvent\getRequest
getRequest()
Definition: FilterViewBuilderParametersEvent.php:37
eZ\Publish\Core\MVC\Symfony\View\ViewEvents
Events constants of views.
Definition: ViewEvents.php:13
eZ\Publish\Core\MVC\Symfony\View\ViewEvents\FILTER_BUILDER_PARAMETERS
const FILTER_BUILDER_PARAMETERS
Dispatched before the ViewBuilder is called to collect the ViewBuilder parameters.
Definition: ViewEvents.php:21
eZ\Publish\Core\MVC\Symfony\View\Builder\ParametersFilter
Definition: RequestAttributes.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.