Manual:Hooks/ApiOptions

ApiOptions
Available from version 1.33.0 (Gerrit change 447730)
Called by action=options before applying changes to user preferences.
Define function:
public static function onApiOptions( ApiOptions $apiModule, User $user, array $changes, array $resetKinds ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ApiOptions": "MediaWiki\\Extension\\MyExtension\\Hooks::onApiOptions"
	}
}
Called from: File(s): api/ApiOptions.php
Function(s): execute
Interface: ApiOptionsHook.php

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


Details

edit
  • $apiModule: Calling ApiOptions object
  • $user: User object whose preferences are being changed
  • $changes: Associative array of preference name => value
  • $resetKinds: Array of strings specifying which options kinds to reset. See User::resetOptions() and User::getOptionKinds() for possible values.