Manual:Hooks/APIQueryInfoTokens
From MediaWiki.org
| APIQueryInfoTokens | |
|---|---|
| Available from version 1.13.0 Use this hook to add custom tokens to prop=info. |
|
Define function: |
public static function onAPIQueryInfoTokens( &$tokenFunctions ) { ... }
|
Attach hook: |
$wgHooks['APIQueryInfoTokens'][] = 'MyExtensionHooks::onAPIQueryInfoTokens'; |
| Called from: | ApiQueryInfo.php |
For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:APIQueryInfoTokens extensions.
Details [edit]
- $tokenFunctions: array(action => callback)
Notes [edit]
Every token has an action, which will be used in the intoken parameter and in the output (actiontoken="..."), and a callback function which should return the token, or false if the user isn't allowed to obtain it.
The prototype of the callback function is func($pageid, $title) where $pageid is the page ID of the page the token is requested for and $title is the associated Title object. In the hook, just add your callback to the $tokenFunctions array and return true (returning false makes no sense)
