jenkins-bot has submitted this change and it was merged.
Change subject: Hygiene: Move wgResourceLoaderLESSVars out of extension function
......................................................................
Hygiene: Move wgResourceLoaderLESSVars out of extension function
Depends core change: I5a73bbd0ab58f8fe34519931c4f26c90998e3451
Change-Id: If1a25593ff38270a1a3d356e996f6325d34504f8
---
M MobileFrontend.php
M includes/MobileFrontend.hooks.php
2 files changed, 24 insertions(+), 11 deletions(-)
Approvals:
Legoktm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/MobileFrontend.php b/MobileFrontend.php
index 6070679..1d0d61d 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -158,6 +158,7 @@
$wgHooks['OutputPageParserOutput'][] =
'MobileFrontendHooks::onOutputPageParserOutput';
$wgHooks['HTMLFileCache::useFileCache'][] =
'MobileFrontendHooks::onHTMLFileCache_useFileCache';
$wgHooks['LoginFormValidErrorMessages'][] =
'MobileFrontendHooks::onLoginFormValidErrorMessages';
+$wgHooks['ResourceLoaderGetLessVars'][] =
'MobileFrontendHooks::onResourceLoaderGetLessVars';
// use array_merge to ensure we do not override existing values set by core
$wgSpecialPages = array_merge( $wgSpecialPages, array(
@@ -184,23 +185,14 @@
* Setup MobileFrontend, load global components
*/
function efMobileFrontend_Setup() {
- global $wgMFNearby, $wgSpecialPages, $wgSpecialPageGroups,
$wgResourceLoaderLESSVars,
+ global $wgMFNearby, $wgSpecialPages, $wgSpecialPageGroups,
$wgResourceLoaderLESSImportPaths,
- $wgMFDeviceWidthTablet, $wgMFDeviceWidthMobileSmall,
$wgMobileVEModules;
+ $wgMobileVEModules;
if ( $wgMFNearby ) {
$wgSpecialPages['Nearby'] = 'SpecialNearby';
$wgSpecialPageGroups['Nearby'] = 'pages';
}
- $wgResourceLoaderLESSVars = array_merge( $wgResourceLoaderLESSVars,
- array(
- 'wgMFDeviceWidthTablet' => "{$wgMFDeviceWidthTablet}px",
- 'wgMFDeviceWidthMobileSmall' =>
"{$wgMFDeviceWidthMobileSmall}px",
- 'wgMFThumbnailTiny' => MobilePage::TINY_IMAGE_WIDTH .
'px',
- 'wgMFThumbnailSmall' => MobilePage::SMALL_IMAGE_WIDTH
. 'px',
- 'wgMFThumbnailMedium' => MobilePage::MEDIUM_IMAGE_WIDTH
. 'px',
- )
- );
}
// Config instance
diff --git a/includes/MobileFrontend.hooks.php
b/includes/MobileFrontend.hooks.php
index 2c79dde..03c2995 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -831,6 +831,27 @@
}
/**
+ * 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 ) {
+ $config = MobileContext::singleton()->getMFConfig();
+ $lessVars = array_merge( $lessVars,
+ array(
+ 'wgMFDeviceWidthTablet' => "{$config->get(
'MFDeviceWidthTablet' )}px",
+ 'wgMFDeviceWidthMobileSmall' => "{$config->get(
'MFDeviceWidthMobileSmall' )}px",
+ 'wgMFThumbnailTiny' =>
MobilePage::TINY_IMAGE_WIDTH . 'px',
+ 'wgMFThumbnailSmall' =>
MobilePage::SMALL_IMAGE_WIDTH . 'px',
+ 'wgMFThumbnailMedium' =>
MobilePage::MEDIUM_IMAGE_WIDTH . 'px',
+ )
+ );
+ }
+
+ /**
* EventLoggingRegisterSchemas hook handler.
*
* Registers our EventLogging schemas so that they can be converted to
--
To view, visit https://gerrit.wikimedia.org/r/187947
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If1a25593ff38270a1a3d356e996f6325d34504f8
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits