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

Change subject: Minerva should use FeatureManagers class
......................................................................

Minerva should use FeatureManagers class

Bug: T182362
Change-Id: I6ba5bf49b9060c31ad2224a437072b3426a45619
---
M includes/Minerva.hooks.php
M skin.json
2 files changed, 33 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/MinervaNeue 
refs/changes/65/403065/1

diff --git a/includes/Minerva.hooks.php b/includes/Minerva.hooks.php
index c65d939..f68bc02 100644
--- a/includes/Minerva.hooks.php
+++ b/includes/Minerva.hooks.php
@@ -28,6 +28,30 @@
        }
 
        /**
+        * Register mobile web beta features
+        * @see https://www.mediawiki.org/wiki/
+       *   Extension:MobileFrontend/MobileFrontendFeaturesRegistration
+        *
+        * @param MobileFrontend\Features\FeaturesManager $featureManager
+        * @return bool
+        */
+       public static function onMobileFrontendFeaturesRegistration( 
$featureManager ) {
+               $config = MediaWikiServices::getInstance()->getConfigFactory()
+                       ->makeConfig( 'minerva' );
+
+               $featureManager->registerFeature(
+                       new MobileFrontend\Features\Feature( 
'MinervaShowCategoriesButton',
+                               $config->get( 'MinervaShowCategoriesButton' )
+                       )
+               );
+               $featureManager->registerFeature(
+                       new MobileFrontend\Features\Feature( 
'MinervaEnableBackToTop',
+                               $config->get( 'MinervaEnableBackToTop' )
+                       )
+               );
+       }
+
+       /**
         * Skin registration callback.
         */
        public static function onRegistration() {
@@ -132,13 +156,17 @@
        ) {
                // setSkinOptions is not available
                if ( $skin instanceof SkinMinerva ) {
+                       $featureManager = 
\MediaWiki\MediaWikiServices::getInstance();
+
                        $skin->setSkinOptions( [
                                SkinMinerva::OPTIONS_MOBILE_BETA
                                        => $mobileContext->isBetaGroupMember(),
+
+                               // @todo
                                SkinMinerva::OPTION_CATEGORIES
-                                       => $mobileContext->getConfigVariable( 
'MinervaShowCategoriesButton' ),
+                                       => $featureManager->isFeatureEnabled( 
'MinervaShowCategoriesButton'),
                                SkinMinerva::OPTION_BACK_TO_TOP
-                                       => $mobileContext->getConfigVariable( 
'MinervaEnableBackToTop' ),
+                                       => $featureManager->isFeatureEnabled( 
'MinervaEnableBackToTop' ),
                                SkinMinerva::OPTION_TOGGLING => true,
                                SkinMinerva::OPTION_MOBILE_OPTIONS => true,
                        ] );
diff --git a/skin.json b/skin.json
index d00c5bf..dba27d1 100644
--- a/skin.json
+++ b/skin.json
@@ -15,6 +15,9 @@
                "minerva": "GlobalVarConfig::newInstance"
        },
        "Hooks": {
+               "MobileFrontendFeaturesRegistration": [
+                       "MinervaHooks::onMobileFrontendFeaturesRegistration"
+               ],
                "RequestContextCreateSkinMobile": [
                        "MinervaHooks::onRequestContextCreateSkinMobile"
                ],

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ba5bf49b9060c31ad2224a437072b3426a45619
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/MinervaNeue
Gerrit-Branch: specialpages
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