Manual:Hooks/UserGetLanguageObject

From MediaWiki.org
Jump to: navigation, search
UserGetLanguageObject
Available from version 1.18.0 (r83405)
Called when getting user's interface language object.
Define function:
public static function onUserGetLanguageObject( $user, &$code ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"UserGetLanguageObject": [
			"MyExtensionHooks::onUserGetLanguageObject"
		]
	}
}

For MediaWiki ≤1.25:

$wgHooks['UserGetLanguageObject'][] = 'MyExtensionHooks::onUserGetLanguageObject';
Called from: File(s): RequestContext.php

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

Details[edit]

  • $user: User object
  • &$code: Language code that will be used to create the object