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

Change subject: setMobileOptions at time of skin creation
......................................................................

setMobileOptions at time of skin creation

Introduce RequestContextCreateSkinMobile hook and use it to set
mobile specific options before rendering takes place

The hook should only run when a render is operating in mobile mode
so skins can safely use it without worrying about it impacting
modules loaded on a page.

This fixes the loading of JS and CSS for the mobile beta features

Bug: T125588
Change-Id: Ica0663fc6687e4a7ec6338484e495b630f05c97e
(cherry picked from commit 01361ad67988b473c0fa4b988bf57674214f42c7)
---
M extension.json
M includes/Minerva.hooks.php
M includes/MobileFrontend.hooks.php
3 files changed, 6 insertions(+), 5 deletions(-)


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

diff --git a/extension.json b/extension.json
index 836a32d..622fdc2 100644
--- a/extension.json
+++ b/extension.json
@@ -1609,8 +1609,8 @@
                "APIGetDescription": [
                        "ApiParseExtender::onAPIGetDescription"
                ],
-               "BeforePageDisplayMobile": [
-                       "MinervaHooks::onBeforePageDisplayMobile"
+               "RequestContextCreateSkinMobile": [
+                       "MinervaHooks::onRequestContextCreateSkinMobile"
                ],
                "RequestContextCreateSkin": [
                        "MobileFrontendHooks::onRequestContextCreateSkin"
diff --git a/includes/Minerva.hooks.php b/includes/Minerva.hooks.php
index 07baabf..cacafff 100644
--- a/includes/Minerva.hooks.php
+++ b/includes/Minerva.hooks.php
@@ -64,9 +64,9 @@
         * @param OutputPage $out
         * @param Skin $skin
         */
-       public static function onBeforePageDisplayMobile( OutputPage $out, Skin 
$skin ) {
-               // In mobile mode MobileContext will always be available.
-               $mobileContext = MobileContext::singleton();
+       public static function onRequestContextCreateSkinMobile(
+               MobileContext $mobileContext, Skin $skin
+       ) {
                // setSkinOptions is not available
                if ( $skin instanceof SkinMinerva ) {
                        $skin->setSkinOptions( [
diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index 1fa6740..aca4ee2 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -120,6 +120,7 @@
                        }
                }
                $skin = self::getDefaultMobileSkin( $context, $mobileContext );
+               Hooks::run( 'RequestContextCreateSkinMobile', [ $mobileContext, 
$skin ] );
 
                return false;
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica0663fc6687e4a7ec6338484e495b630f05c97e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: wmf/1.29.0-wmf.20
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