Jdlrobson has uploaded a new change for review. https://gerrit.wikimedia.org/r/68556
Change subject: Allow other projects to define their own mobile skin ...................................................................... Allow other projects to define their own mobile skin This also allows you to use the desktop skin SkinMinerva as the mobile skin. Change-Id: I350fed006a4666c3900b2e5fa1aa17ea036e7694 --- M MobileFrontend.php M includes/MobileFrontend.hooks.php M includes/skins/SkinMobileBase.php 3 files changed, 15 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/56/68556/1 diff --git a/MobileFrontend.php b/MobileFrontend.php index 554a4d8..054ab37 100644 --- a/MobileFrontend.php +++ b/MobileFrontend.php @@ -140,6 +140,12 @@ */ /** + * The default skin for MobileFrontend + * Defaults to MobileSkin + */ +$wgMFDefaultSkinClass = 'SkinMobile'; + +/** * An api to which any photos should be uploaded * e.g. $wgMFPhotoUploadEndpoint = 'http://commons.wikimedia.org/w/api.php'; * Defaults to the current wiki diff --git a/includes/MobileFrontend.hooks.php b/includes/MobileFrontend.hooks.php index c825408..f7873f7 100644 --- a/includes/MobileFrontend.hooks.php +++ b/includes/MobileFrontend.hooks.php @@ -41,7 +41,7 @@ * @return bool */ public static function onRequestContextCreateSkin( $context, &$skin ) { - global $wgMFEnableDesktopResources, $wgExtMobileFrontend; + global $wgMFEnableDesktopResources, $wgExtMobileFrontend, $wgMFDefaultSkinClass; // check whether or not the user has requested to toggle their view $mobileContext = MobileContext::singleton(); @@ -73,7 +73,14 @@ // log whether user is using alpha/beta/stable $mobileContext->logMobileMode(); - $skin = SkinMobile::factory( $wgExtMobileFrontend ); + if ( $mobileContext->getContentFormat() == 'HTML' ) { + # Grab the skin class and initialise it. + if ( class_exists( $wgMFDefaultSkinClass ) ) { + $skin = new $wgMFDefaultSkinClass( $wgExtMobileFrontend ); + } + } else { + $skin = new SkinMobileWML( $wgExtMobileFrontend ); + } return false; } diff --git a/includes/skins/SkinMobileBase.php b/includes/skins/SkinMobileBase.php index 9e1a201..658eb28 100644 --- a/includes/skins/SkinMobileBase.php +++ b/includes/skins/SkinMobileBase.php @@ -163,15 +163,6 @@ return $className . implode( ' ', array_keys( $this->pageClassNames ) ); } - public static function factory( ExtMobileFrontend $extMobileFrontend ) { - if ( MobileContext::singleton()->getContentFormat() == 'HTML' ) { - $skinClass = 'SkinMobile'; - } else { - $skinClass = 'SkinMobileWML'; - } - return new $skinClass( $extMobileFrontend ); - } - public function __construct( ExtMobileFrontend $extMobileFrontend ) { $this->setContext( $extMobileFrontend ); $this->extMobileFrontend = $extMobileFrontend; -- To view, visit https://gerrit.wikimedia.org/r/68556 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I350fed006a4666c3900b2e5fa1aa17ea036e7694 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Jdlrobson <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
