From 7356e66e286a4debe7faea1892a97105aee33676 Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Wed, 10 Oct 2018 10:25:28 -0700 Subject: [PATCH] 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 --- docs/hooks.txt | 2 ++ includes/resourceloader/ResourceLoaderStartUpModule.php | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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; } -- 2.20.1