diff --git a/source/development/user-interface/layout-template-usage.rst b/source/development/user-interface/layout-template-usage.rst index 14404b907..2b7a7764c 100644 --- a/source/development/user-interface/layout-template-usage.rst +++ b/source/development/user-interface/layout-template-usage.rst @@ -45,6 +45,22 @@ When customizing the template, two arguments are passed to the template: - :code:`value`: the actual value ; - :code:`message`: the message, given as argument +Routing with return path +------------------------ + +Three twig function are available for creating routes and handling "return path". + +**Rationale**: When building a "CRUD" (CReate, Update, Delete of an entity), you would like to allow people to go back on some custom cancel page when coming for another place of an application. For instance, if you are in the timeline and show an activity, you would like that the user go back to the timeline when pressing the "return" button at the bottom of the page, instead of going back to the "activity list" page. + +Using those function, a :code:`returnPath` parameter will be added in the path generated. It will be used instead of the default one in the subsequente pages. + +- :code:`chill_path_add_return_path(name, parameters = [], relative = false)`: will create a path with current page as return path (users will go back to the current page on the next page) ; +- :code:`chill_return_path_or(name, parameters = [], relative = false)`: will create a path to the return path if present, or build the path according to the given parameters ; +- :code:`chill_path_forward_return_path(name, parameters = [], relative = false)`: will create a path and adding the return path that is present for the current page, *forwarding* the return path to the next page. This is useful if you are on a "show" page with a return path (by instance, the "timeline" page), you place a link to the *edit* page and want users to go back to the "timeline" page on the edit page. + + +- :code:`chill_return_path_or`: + Organisation of the layouts ===========================