Manual:Hooks/ApiTokensGetTokenTypes

From MediaWiki.org
Jump to navigation Jump to search
ApiTokensGetTokenTypes
Available from version 1.20.0
Use this hook to extend action=tokens with new token types.
Define function:
public static function onApiTokensGetTokenTypes( &$tokenTypes ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ApiTokensGetTokenTypes": "MyExtensionHooks::onApiTokensGetTokenTypes"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ApiTokensGetTokenTypes'][] = 'MyExtensionHooks::onApiTokensGetTokenTypes';
Called from:File(s): ApiTokens.php

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:ApiTokensGetTokenTypes extensions.

Details[edit]

  • &$tokenTypes: supported token types in format 'type' => callback function used to retrieve this type of tokens.