From: Roan Kattouw Date: Sun, 9 Jan 2011 11:44:52 +0000 (+0000) Subject: Add a hook for registering variables in ResourceLoaderStartUpModule::getConfig()... X-Git-Tag: 1.31.0-rc.0~32677 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=7de66bd84f79da536e83a27d9650d2bb8b1b671d;p=lhc%2Fweb%2Fwiklou.git Add a hook for registering variables in ResourceLoaderStartUpModule::getConfig() to complement MakeGlobalVariablesScript --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 1bd62b23d0..290b86e9a1 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1115,7 +1115,9 @@ $magicWords: array of strings $variableIDs: array of strings 'MakeGlobalVariablesScript': called right before Skin::makeVariablesScript -is executed +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 ResourceLoaderConfigVars instead. &$vars: variable (or multiple variables) to be added into the output of Skin::makeVariablesScript @@ -1376,9 +1378,15 @@ loader request or generating HTML output. &$obj: RawPage object &$text: The text that's going to be the output -'RecentChange_save': called at the end of RecenChange::save() +'RecentChange_save': called at the end of RecentChange::save() $recentChange: RecentChange object +'ResourceLoaderConfigVars': called at the end of +ResourceLoaderStartUpModule::getConfig(). Use this to export static +configuration variables to JavaScript. Things that depend on the current +page/request state must be added through MakeGlobalVariablesScript instead. +&$vars: array( variable name => value ) + 'RevisionInsertComplete': called after a revision is inserted into the DB &$revision: the Revision $data: the data stored in old_text. The meaning depends on $flags: if external diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index 15a68307f5..f9190c2856 100644 --- a/includes/resourceloader/ResourceLoaderStartUpModule.php +++ b/includes/resourceloader/ResourceLoaderStartUpModule.php @@ -85,6 +85,8 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { $vars['wgMWSuggestTemplate'] = SearchEngine::getMWSuggestTemplate(); } + wfRunHooks( 'ResourceLoaderGetConfigVars', array( &$vars ) ); + return $vars; }