devel:action_plugins
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
devel:action_plugins [2013-11-01 19:09] – Klap-in | devel:action_plugins [2017-08-18 17:47] – Correct misspelling 'class action_plugin_actionexample' 50.226.69.58 | ||
---|---|---|---|
Line 6: | Line 6: | ||
===== Working principle ===== | ===== Working principle ===== | ||
- | Action plugins are loaded before any significant DokuWiki processing takes place. Immediately after loading, each plugin is called by its '' | + | Action plugins are loaded before any significant DokuWiki processing takes place. Immediately after loading, each plugin is called by its '' |
===== Synopsis ===== | ===== Synopsis ===== | ||
Line 22: | Line 22: | ||
An action plugin requires at least two methods: | An action plugin requires at least two methods: | ||
* **'' | * **'' | ||
- | * **''< | + | * **''< |
You can register multiple events in a single action plugin. When doing this you may need multiple ''< | You can register multiple events in a single action plugin. When doing this you may need multiple ''< | ||
Line 30: | Line 30: | ||
===== register() method===== | ===== register() method===== | ||
- | The '' | + | The '' |
<code php> | <code php> | ||
/** | /** | ||
Line 39: | Line 39: | ||
* @return not required | * @return not required | ||
*/ | */ | ||
- | function register(Doku_Event_Handler $controller) { | + | public |
- | $controller-> | + | $controller-> |
} | } | ||
</ | </ | ||
Line 49: | Line 49: | ||
- '' | - '' | ||
- ''< | - ''< | ||
- | - ''< | + | - ''< |
+ | - ''< | ||
+ | |||
+ | | -3999 - -3000 | for "very early" | | ||
+ | | -2999 - -2000 | for " | ||
+ | | -1999 - -1000 | for " | ||
+ | | -999 - -1 | for " | ||
+ | | 0 | default | | ||
+ | | 1 - 999 | for "later than default" | ||
+ | | 1000 - 1999 | for " | ||
+ | | 2000 - 2999 | for " | ||
+ | | 3000 - 3999 | for "very late" | | ||
===== <event handler> | ===== <event handler> | ||
- | Have as many as necessary, can be given any name not already in use in this plugin or its ancestor classes. This function must be public. It will be called by DokuWikis | + | Have as many as necessary, can be given any name not already in use in this plugin or its ancestor classes. This function must be public. It will be called by DokuWiki' |
The passed arguments are: | The passed arguments are: | ||
Line 68: | Line 80: | ||
* @return | * @return | ||
*/ | */ | ||
- | public function < | + | public function < |
// custom script statements ... | // custom script statements ... | ||
} | } | ||
Line 86: | Line 98: | ||
Here some examples: | Here some examples: | ||
- | * Below: [[# | + | * Below: [[#Sample: Add always a JavaScript file |Sample Action Plugin]] -- include javascript file in all pages |
- | * Below: [[# | + | * Below: [[#Sample: Add toolbar button|Sample Action Plugin]] -- insert button in toolbar |
* Examples of [[Event handlers code]] | * Examples of [[Event handlers code]] | ||
* [[event_handlers_code# | * [[event_handlers_code# | ||
Line 95: | Line 107: | ||
* Dumps of [[Event Objects]] -- examples of event objects for some events | * Dumps of [[Event Objects]] -- examples of event objects for some events | ||
* Implementation of a custom [[Section Editor]] | * Implementation of a custom [[Section Editor]] | ||
+ | * [[devel: | ||
Line 120: | Line 133: | ||
* Register its handlers with the DokuWiki' | * Register its handlers with the DokuWiki' | ||
*/ | */ | ||
- | function register(Doku_Event_Handler $controller) { | + | |
$controller-> | $controller-> | ||
' | ' | ||
Line 130: | Line 143: | ||
* @author Samuele Tognini < | * @author Samuele Tognini < | ||
*/ | */ | ||
- | function _hookjs(&$event, $param) { | + | |
$event-> | $event-> | ||
' | ' | ||
Line 156: | Line 169: | ||
if (!defined(' | if (!defined(' | ||
- | class action_plugin_actionexample | + | class action_plugin_example |
/** | /** | ||
* Register the eventhandlers | * Register the eventhandlers | ||
*/ | */ | ||
- | function register(Doku_Event_Handler $controller) { | + | |
$controller-> | $controller-> | ||
} | } | ||
Line 168: | Line 181: | ||
* Inserts the toolbar button | * Inserts the toolbar button | ||
*/ | */ | ||
- | function insert_button(& $event, $param) { | + | |
$event-> | $event-> | ||
' | ' |
devel/action_plugins.txt · Last modified: 2023-09-01 23:52 by Klap-in