Completed
Push — wip-platform ( 03cba6...2999ab )
by
unknown
05:53 queued 02:49
created

BaseController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 36
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 22 2
1
<?php
2
3
/*
4
 *
5
 * Copyright (C) 2015-2017 Libre Informatique
6
 *
7
 * This file is licenced under the GNU LGPL v3.
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Blast\Bundle\CoreBundle\Controller;
13
14
use Sonata\AdminBundle\Controller\CoreController as BaseCoreController;
15
use Symfony\Component\HttpFoundation\Response;
16
17
/**
18
 * Class BaseController.
19
 *
20
 * Extends this controller if you want to render a custom view withing sonata'as admin layout.
21
 * Your view has to extends the sonata's admin layout (or overrided layouts)
22
 */
23
class BaseController extends BaseCoreController
24
{
25
    /**
26
     * render.
27
     *
28
     *  ** Overrided to add default sonata's twig parameters
29
     *
30
     * @param string        $view
31
     * @param array         $parameters
32
     * @param Response|null $response
33
     *
34
     * @return Response
35
     */
36
    public function render($view, array $parameters = array(), Response $response = null)
37
    {
38
        $blocks = array(
39
            'top'    => array(),
40
            'left'   => array(),
41
            'center' => array(),
42
            'right'  => array(),
43
            'bottom' => array(),
44
        );
45
46
        foreach ($this->container->getParameter('sonata.admin.configuration.dashboard_blocks') as $block) {
47
            $blocks[$block['position']][] = $block;
48
        }
49
50
        $completeParameters = [
51
            'base_template' => $this->getBaseTemplate(),
52
            'admin_pool'    => $this->container->get('sonata.admin.pool'),
53
            'blocks'        => $blocks,
54
        ];
55
56
        return parent::render($view, array_merge($parameters, $completeParameters), $response); // TODO: Change the autogenerated stub
57
    }
58
}
59