DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:action_router

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devel:action_router [2018-03-29 12:43] andidevel:action_router [2023-09-19 08:50] (current) – [Output] andi
Line 1: Line 1:
 ====== Action Router ====== ====== Action Router ======
- 
-[[develonly]] 
  
 The [[xref>ActionRouter]] is the central part that decides what should happen on a request to a Dokuwiki instance based on the [[action mode]]. The [[xref>ActionRouter]] is the central part that decides what should happen on a request to a Dokuwiki instance based on the [[action mode]].
Line 13: Line 11:
   - check if the action is disabled through [[config:disableactions]] or by the auth backend   - check if the action is disabled through [[config:disableactions]] or by the auth backend
     * if yes, shows a message and switches to ''show'' or ''redirect'' actions for GET and POST request respectively     * if yes, shows a message and switches to ''show'' or ''redirect'' actions for GET and POST request respectively
-  - ''Action::checkPermissions''+  - ''Action::checkPreconditions''
     * The action itself can do custom checks that are required to use this action. An [[xref>ActionException]] is to be thrown if permissions aren't met     * The action itself can do custom checks that are required to use this action. An [[xref>ActionException]] is to be thrown if permissions aren't met
   - ''Action::minimumPermission''   - ''Action::minimumPermission''
Line 26: Line 24:
 Once the action has been decided, DokuWiki continues the flow, loads the template and will finally reach a call to [[xref>tpl_content()]] which gets the current action from the router and calls ''Action::tplContent()'' on it which returns the actual HTML to output. Once the action has been decided, DokuWiki continues the flow, loads the template and will finally reach a call to [[xref>tpl_content()]] which gets the current action from the router and calls ''Action::tplContent()'' on it which returns the actual HTML to output.
  
-Note, that not all actions may have a ''tplContent'' method, because they either abort to a different action earlier or because they abort the whole further flow and output their own content (''think export_html'').+Note, that not all actions may have a ''tplContent'' method, because they either abort to a different action earlier or because they abort the whole further flow and output their own content (think ''export_html'').
  
 ===== Action Plugins ===== ===== Action Plugins =====
Line 34: Line 32:
 The [[devel:event:ACTION_ACT_PREPROCESS]] event basically wraps around all the steps under [[#Action Routing]]. Plugins that prevent the default action in this event's BEFORE phase will then later be handled in the new ''Plugin'' action which has a ''tplContent'' method that triggers [[devel:event:TPL_ACT_UNKNOWN]]. The [[devel:event:ACTION_ACT_PREPROCESS]] event basically wraps around all the steps under [[#Action Routing]]. Plugins that prevent the default action in this event's BEFORE phase will then later be handled in the new ''Plugin'' action which has a ''tplContent'' method that triggers [[devel:event:TPL_ACT_UNKNOWN]].
  
 +
 +==== Change action within a POST request ====
 +If you use the [[devel:event:ACTION_ACT_PREPROCESS]] event, and you have to redirect to the 'show' action, you have to use the 'redirect' action actually. This will reset the parameters as well.
devel/action_router.1522320191.txt.gz · Last modified: 2018-03-29 12:43 by andi

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki