Przeglądaj źródła

add explanation how to keep the current filters. fixes #2808

Oskar Stark 9 lat temu
rodzic
commit
a50d25f092

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

@@ -120,6 +120,12 @@ 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.
 
 
+If you want to add the current filter parameters to the redirect url you can add them to the `generateUrl` method:
+
+.. code-block:: php
+
+    return new RedirectResponse($this->admin->generateUrl('list', array('filter' => $this->admin->getFilterParameters())));
+
 Using template in new controller
 Using template in new controller
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~