瀏覽代碼

Docs custom action: notice about creating template

And extending sonata layout
Michał Zagdan 10 年之前
父節點
當前提交
1c9c91df97
共有 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
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^