Manual:Hooks/ApiQueryTokensRegisterTypes

From Linux Web Expert

ApiQueryTokensRegisterTypes
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 153110)</tvar></translate>
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.
<translate> Define function:</translate>
public static function onApiQueryTokensRegisterTypes( &$salts ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"ApiQueryTokensRegisterTypes": "MediaWiki\\Extension\\MyExtension\\Hooks::onApiQueryTokensRegisterTypes"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> api/ApiQueryTokens.php
<translate> Function(s):</translate> getTokenTypeSalts
<translate> Interface:</translate> ApiQueryTokensRegisterTypesHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:ApiQueryTokensRegisterTypes extensions</tvar>.</translate>


Details

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