Completed
Push — travis_trusty ( b242e6...daf958 )
by André
17:21
created

ViewbaseLayout::setPageLayout()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * @license For full copyright and license information view LICENSE file distributed with this source code.
4
 */
5
namespace eZ\Publish\Core\MVC\Symfony\View\ParametersInjector;
6
7
use eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewParametersEvent;
8
use eZ\Publish\Core\MVC\Symfony\View\ViewEvents;
9
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
10
11
/**
12
 * Injects the 'viewBaseLayout' view parameter, set by the container parameter.
13
 */
14
class ViewbaseLayout implements EventSubscriberInterface
15
{
16
    /**
17
     * @var string
18
     */
19
    private $pageLayout;
20
21
    /**
22
     * @var string
23
     */
24
    private $viewbaseLayout;
25
26
    public function __construct($viewbaseLayout)
27
    {
28
        $this->viewbaseLayout = $viewbaseLayout;
29
    }
30
31
    public function setPageLayout($pageLayout)
32
    {
33
        $this->pageLayout = $pageLayout;
34
    }
35
36
    public static function getSubscribedEvents()
37
    {
38
        return [ViewEvents::FILTER_VIEW_PARAMETERS => 'injectViewbaseLayout'];
39
    }
40
41
    public function injectViewbaseLayout(FilterViewParametersEvent $event)
42
    {
43
        $event->getParameterBag()->set('viewbaseLayout', $this->viewbaseLayout);
44
        $event->getParameterBag()->set('pagelayout', $this->pageLayout);
45
    }
46
}
47