GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Main page
  • Get MediaWiki
  • Get extensions
  • Tech blog
  • Contribute
  • User help
  • FAQ
  • Technical manual
  • Support desk
  • Communication
  • Developer portal
  • Code statistics
  • Community portal
  • Recent changes

This view

  • Original page
  • New address

GeezerVison is showing www.mediawiki.org — Manual:Hooks/MakeGlobalVariablesScript - MediaWiki

< 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": "MediaWiki\\Extension\\MyExtension\\Hooks::onMakeGlobalVariablesScript"
	}
}
Called from: File(s): Output/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
Retrieved from "https://www.mediawiki.org/w/index.php?title=Manual:Hooks/MakeGlobalVariablesScript&oldid=8362804"
Categories:
  • MediaWiki hooks
  • Hooks added in MediaWiki 1.14.0
  • MediaWiki hooks included in OutputPage.php
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.