Jdlrobson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354717 )

Change subject: Register wgMinervaApplyKnownTemplateHacks via a Minerva hook
......................................................................

Register wgMinervaApplyKnownTemplateHacks via a Minerva hook

Change-Id: I6c451125532752c6d3865bce608145bd30821524
---
M extension.json
M includes/Minerva.hooks.php
M includes/MobileFrontend.hooks.php
3 files changed, 19 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/17/354717/1

diff --git a/extension.json b/extension.json
index 21c1648..fa21c92 100644
--- a/extension.json
+++ b/extension.json
@@ -1741,6 +1741,7 @@
                        "MobileFrontendHooks::onLoginFormValidErrorMessages"
                ],
                "ResourceLoaderGetLessVars": [
+                       "MinervaHooks::onResourceLoaderGetLessVars",
                        "MobileFrontendHooks::onResourceLoaderGetLessVars"
                ],
                "ThumbnailBeforeProduceHTML": [
diff --git a/includes/Minerva.hooks.php b/includes/Minerva.hooks.php
index 4ad92fc..58af460 100644
--- a/includes/Minerva.hooks.php
+++ b/includes/Minerva.hooks.php
@@ -13,6 +13,24 @@
  */
 class MinervaHooks {
        /**
+        * ResourceLoaderGetLessVars hook handler
+        *
+        * Add the context-based less variables.
+        *
+        * @see 
https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderGetLessVars
+        * @param array &$lessVars Variables already added
+        */
+       public static function onResourceLoaderGetLessVars( &$lessVars ) {
+               // FIXME: Load from Minerva.Config when MobileFrontend and 
Minerva are separated
+               $config = MobileContext::singleton()->getMFConfig();
+               $lessVars = array_merge( $lessVars,
+                       [
+                               'wgMinervaApplyKnownTemplateHacks' => 
"{$config->get( 'MinervaApplyKnownTemplateHacks' )}",
+                       ]
+               );
+       }
+
+       /**
         * Invocation of hook SpecialPageBeforeExecute
         *
         * We use this hook to ensure that login/account creation pages
diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index 56b630b..f4941e9 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -1035,7 +1035,6 @@
                $lessVars = array_merge( $lessVars,
                        [
                                'wgMFDeviceWidthMobileSmall' => "{$config->get( 
'MFDeviceWidthMobileSmall' )}px",
-                               'wgMinervaApplyKnownTemplateHacks' => 
"{$config->get( 'MinervaApplyKnownTemplateHacks' )}",
                                'wgMFThumbnailTiny' =>  
MobilePage::TINY_IMAGE_WIDTH . 'px',
                                'wgMFThumbnailSmall' =>  
MobilePage::SMALL_IMAGE_WIDTH . 'px'
                        ]

-- 
To view, visit https://gerrit.wikimedia.org/r/354717
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6c451125532752c6d3865bce608145bd30821524
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to