From: jdlrobson Date: Wed, 10 Oct 2018 17:25:28 +0000 (-0700) Subject: resourceloader: ResourceLoaderGetConfigVars is passed skin X-Git-Tag: 1.34.0-rc.0~3627^2 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=7356e66e286a4debe7faea1892a97105aee33676;p=lhc%2Fweb%2Fwiklou.git resourceloader: ResourceLoaderGetConfigVars is passed skin The startup module varies by skin, so it should be possible for consumers of the ResourceLoaderGetConfigVars hook to know what skin it being requested. Bug: T186062 Change-Id: I97d6b4bc245bc64ff148c3665b46116b8a6be409 --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 90b2b05f1e..96ddf1d45b 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -2877,7 +2877,9 @@ $context: ResourceLoaderContext|null ResourceLoaderStartUpModule::getConfigSettings(). Use this to export static configuration variables to JavaScript. Things that depend on the current page or request state must be added through MakeGlobalVariablesScript instead. +Skin is made available for skin specific config. &$vars: [ variable name => value ] +$skin: Skin 'ResourceLoaderJqueryMsgModuleMagicWords': Called in ResourceLoaderJqueryMsgModule to allow adding magic words for jQueryMsg. diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index e4a753fc16..b5d31efac7 100644 --- a/includes/resourceloader/ResourceLoaderStartUpModule.php +++ b/includes/resourceloader/ResourceLoaderStartUpModule.php @@ -78,10 +78,11 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD; // Build list of variables + $skin = $context->getSkin(); $vars = [ 'wgLoadScript' => wfScript( 'load' ), 'debug' => $context->getDebug(), - 'skin' => $context->getSkin(), + 'skin' => $skin, 'stylepath' => $conf->get( 'StylePath' ), 'wgUrlProtocols' => wfUrlProtocols(), 'wgArticlePath' => $conf->get( 'ArticlePath' ), @@ -126,7 +127,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { 'wgCommentCodePointLimit' => $oldCommentSchema ? null : CommentStore::COMMENT_CHARACTER_LIMIT, ]; - Hooks::run( 'ResourceLoaderGetConfigVars', [ &$vars ] ); + Hooks::run( 'ResourceLoaderGetConfigVars', [ &$vars, $skin ] ); return $vars; }