Manual:Hooks/ApiQueryTokensRegisterTypes

ApiQueryTokensRegisterTypes
Available from version 1.24.0 (Gerrit change 153110)
Use this hook to add additional token types to action=query&meta=tokens. Note that most modules will probably be able to use the 'csrf' token instead of creating their own token types.
Define function:
public static function onApiQueryTokensRegisterTypes( &$salts ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ApiQueryTokensRegisterTypes": "MediaWiki\\Extension\\MyExtension\\Hooks::onApiQueryTokensRegisterTypes"
	}
}
Called from: File(s): api/ApiQueryTokens.php
Function(s): getTokenTypeSalts
Interface: ApiQueryTokensRegisterTypesHook.php

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


Details

edit
  • &$salts: array( type => salt to pass to User::getEditToken() or array of salt and key to pass to Session::getToken() )