forked from sonata-project/SonataAdminBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCoreController.php
44 lines (37 loc) · 1.25 KB
/
CoreController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/*
* This file is part of the Sonata package.
*
* (c) Thomas Rabaix <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\AdminBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpFoundation\Response;
class CoreController extends Controller
{
/**
* @return string
*/
public function getBaseTemplate()
{
if ($this->getRequest()->isXmlHttpRequest()) {
return $this->container->get('sonata.admin.pool')->getTemplate('ajax');
}
return $this->container->get('sonata.admin.pool')->getTemplate('layout');
}
/**
* @return \Symfony\Bundle\FrameworkBundle\Controller\Response
*/
public function dashboardAction()
{
return $this->render('SonataAdminBundle:Core:dashboard.html.twig', array(
'groups' => $this->get('sonata.admin.pool')->getDashboardGroups(),
'base_template' => $this->getBaseTemplate(),
'admin_pool' => $this->container->get('sonata.admin.pool')
));
}
}