Jelajahi Sumber

Merge pull request #2846 from zergu/patch-1

Docs custom action: notice about creating template
Thomas 10 tahun lalu
induk
melakukan
1bfb643347
1 mengubah file dengan 14 tambahan dan 0 penghapusan
  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
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^