Forráskód Böngészése

Merge pull request #795 from sjopet/master

I added an entry to the configuration to be able to override the block_admin_list.html.twig template
Thomas 13 éve
szülő
commit
984df1a986

+ 1 - 1
Block/AdminListBlockService.php

@@ -57,7 +57,7 @@ class AdminListBlockService extends BaseBlockService
             }
         }
 
-        return $this->renderResponse('SonataAdminBundle:Block:block_admin_list.html.twig', array(
+        return $this->renderResponse($this->pool->getTemplate('list_block'), array(
             'block'         => $block,
             'settings'      => $settings,
             'admin_pool'    => $this->pool,

+ 1 - 0
DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php

@@ -256,6 +256,7 @@ class AddDependencyCallsCompilerPass implements CompilerPassInterface
             'history'           => 'SonataAdminBundle:CRUD:history.html.twig',
             'history_revision'  => 'SonataAdminBundle:CRUD:history_revision.html.twig',
             'action'            => 'SonataAdminBundle:CRUD:action.html.twig',
+            'list_block'        => 'SonataAdminBundle:Block:block_admin_list.html.twig',
         ), $definedTemplates);
 
         $definition->addMethodCall('setTemplates', array($definedTemplates));

+ 1 - 0
DependencyInjection/Configuration.php

@@ -135,6 +135,7 @@ class Configuration implements ConfigurationInterface
                         ->scalarNode('history')->defaultValue('SonataAdminBundle:CRUD:history.html.twig')->cannotBeEmpty()->end()
                         ->scalarNode('history_revision')->defaultValue('SonataAdminBundle:CRUD:history_revision.html.twig')->cannotBeEmpty()->end()
                         ->scalarNode('action')->defaultValue('SonataAdminBundle:CRUD:action.html.twig')->cannotBeEmpty()->end()
+                        ->scalarNode('list_block')->defaultValue('SonataAdminBundle:Block:block_admin_list.html.twig')->cannotBeEmpty()->end()
                     ->end()
                 ->end()
             ->end()

+ 4 - 0
Resources/doc/reference/templates.rst

@@ -17,6 +17,9 @@ By default, an Admin class uses a set of templates, it is possible to tweak the
             edit:    SonataAdminBundle:CRUD:edit.html.twig
             history:  SonataAdminBundle:CRUD:history.html.twig
 
+            # default values of block templates, they should extend the base_block template
+            list_block: SonataAdminBundle:Block:block_admin_list.html.twig
+
 
 Usage of each template :
 
@@ -27,6 +30,7 @@ Usage of each template :
 * show : the template to use for the show action
 * edit : the template to use for the edit and create action
 * history : the template to use for the history / audit action
+* list_block : the template used for the list of admin blocks on the dashboard
 
 The default values will be set only if the ``Admin::setTemplates`` is not called by the Container.