Table of Contents
The ActionRouter uses the
do parameter to determine which action to load. Each action has its own class in
inc/Action inheriting from AbstractAction or one of it's descendants.
When the router considers running an action, there are several steps (methods) that are called on the Action class. All steps can still abort the action, either because some requirements aren't met or because no further processing is needed within the action. When ever an abortion happens, a different action (usually
denied) will be loaded and processing starts again.
- check if the action is disabled through disableactions or by the auth backend
- if yes, shows a message and switches to
redirectactions for GET and POST request respectively
- The action itself can do custom checks that are required to use this action. An ActionException is to be thrown if permissions aren't met
- The action returns the minimum ACL permission needed to execute the action with the current page context. If that minimum is not met, the
deniedaction is loaded
- Any code that should be executed by the action before output is sent to the browser happens here. Processing can still be aborted by throwing an
Once all these steps have been processed, the final action is known and set within the ActionRouter instance.
Once the action has been decided, DokuWiki continues the flow, loads the template and will finally reach a call to 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 (
Action Plugin authors do not need to think much about the action router, previous events still work as before.
The 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 TPL_ACT_UNKNOWN.
Change action within a POST request
If you use the 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.