Manual:Hooks/MakeGlobalVariablesScript
From MediaWiki.org
MakeGlobalVariablesScript | |
---|---|
Available from version 1.14.0 right before OutputPage->getJSVars returns the vars. |
|
Define function: |
function onMakeGlobalVariablesScript( &$vars, &$out ) { ... } |
Attach hook: |
$wgHooks['MakeGlobalVariablesScript'][] = 'MyExtensionHooks::onMakeGlobalVariablesScript'; |
Called from: | OutputPage.php |
For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:MakeGlobalVariablesScript extensions.
[edit] Details
Called right before Skin::makeVariablesScript is executed. Ideally, this hook should only be used to add variables that depend on the current page/request; static configuration should be added through ResourceLoaderGetConfigVars instead.
- &$vars: variable (or multiple variables) to be added into the output of Skin::makeVariablesScript
- &$out (r96015): OutputPage instance calling the hook
- &$wgUser: user (object) who is loading the skin. This was added in r43592 and removed in r43632.