浏览代码

Merge pull request #2846 from zergu/patch-1

Docs custom action: notice about creating template
Thomas 10 年之前
父节点
当前提交
1bfb643347
共有 1 个文件被更改,包括 14 次插入0 次删除
  1. 14 0
      Resources/doc/cookbook/recipe_custom_action.rst

+ 14 - 0
Resources/doc/cookbook/recipe_custom_action.rst

@@ -121,6 +121,20 @@ to implement a ``clone`` action.
 Here we first get the id of the object, see if it exists then clone it and insert the clone
 Here we first get the id of the object, see if it exists then clone it and insert the clone
 as a new object. Finally we set a flash message indicating success and redirect to the list view.
 as a new object. Finally we set a flash message indicating success and redirect to the list view.
 
 
+Using template in new controller
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If you want to render something here you can create new template anywhere, extend sonata layout
+and use `sonata_admin_content` block.
+
+.. code-block:: html+jinja
+
+    {% extends 'SonataAdminBundle::standard_layout.html.twig' %} 
+
+    {% block sonata_admin_content %}
+        Your content here
+    {% endblock %}
+
 Create a template for the new action
 Create a template for the new action
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^