Jump to content

Manual:Hooks/ApiTokensGetTokenTypes

From mediawiki.org
Revision as of 01:55, 18 November 2023 by SamanthaNguyen (talk | contribs) (+gerrit changeset for version removed)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
ApiTokensGetTokenTypes
Available from version 1.20.0
Removed in version 1.36.0 (Gerrit change 625758)
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": "MediaWiki\\Extension\\MyExtension\\Hooks::onApiTokensGetTokenTypes"
	}
}
Called from: File(s): api/ApiTokens.php
Interface: ApiTokensGetTokenTypesHook.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.