< Manual:Hooks
MakeGlobalVariablesScript | |
---|---|
Available from version 1.14.0 right before OutputPage->getJSVars returns the vars. | |
Define function: | public static function onMakeGlobalVariablesScript( array &$vars, OutputPage $out ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"MakeGlobalVariablesScript": "MyExtensionHooks::onMakeGlobalVariablesScript"
}
}
|
Called from: | File(s): OutputPage.php |
Interface: | MakeGlobalVariablesScriptHook.php |
For more information about attaching hooks, see Manual:Hooks
For examples of extensions using this hook, see Category:MakeGlobalVariablesScript extensions.
Details
This hook is fired via getJsVars()
, from OutputPage::headElement()
. 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 OutputPage::headElement.
- $out (r96015): OutputPage instance calling the hook
See also
- ResourceLoaderGetConfigVars
addJsConfigVars()
method of OutputPage
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.