Ver Fonte

Extend the dashboard template from the base_template setting

Pascal Burkhard há 14 anos atrás
pai
commit
4f67ff5f07
2 ficheiros alterados com 11 adições e 2 exclusões
  1. 10 1
      Controller/CoreController.php
  2. 1 1
      Resources/views/Core/dashboard.twig.html

+ 10 - 1
Controller/CoreController.php

@@ -18,6 +18,14 @@ use Symfony\Component\Form\RecursiveFieldIterator;
 
 class CoreController extends Controller
 {
+    public function getBaseTemplate()
+    {        
+        if ($this->get('request')->isXmlHttpRequest()) {
+            return $this->container->getParameter('base_application.templates.ajax');
+        }
+
+        return $this->container->getParameter('base_application.templates.layout');
+    }
 
     public function retrieveFormFieldElementAction($code, $element_id)
     {
@@ -176,7 +184,8 @@ class CoreController extends Controller
     {
 
         return $this->render('SonataBaseApplicationBundle:Core:dashboard.twig.html', array(
-            'groups' => $this->get('base_application.admin.pool')->getGroups()
+            'groups' => $this->get('base_application.admin.pool')->getGroups(),
+            'base_template'  => $this->getBaseTemplate(),
         ));
     }
 }

+ 1 - 1
Resources/views/Core/dashboard.twig.html

@@ -9,7 +9,7 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'SonataBaseApplicationBundle::standard_layout.twig.html' %}
+{% extends base_template %}
 
 {% block title %}{% trans 'title_dashboard' from 'BaseApplicationBundle' %}{% endblock%}
 {% block content %}