From 97136f9d638ec87cf1d85829cd3e682d2e6cd8fb Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Mon, 5 Feb 2018 13:15:34 -0800 Subject: [PATCH] Prepare for breaking change to MobileContext With the introduction of the FeaturesManager the getConfigVariable method will disappear. (I535b24803341dc3912aed4bef06970e2861fe3ad) That change cannot be merged until Minerva stops using the method. This temporary fix ensures it resolves to false when the method doesn't exist. Bug: T182217 Change-Id: I619fd8fac47a98d1ff8f3646d61b8e285246a17f --- includes/Minerva.hooks.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/includes/Minerva.hooks.php b/includes/Minerva.hooks.php index 3996820..52db1cd 100644 --- a/includes/Minerva.hooks.php +++ b/includes/Minerva.hooks.php @@ -125,15 +125,20 @@ class MinervaHooks { public static function onRequestContextCreateSkinMobile( MobileContext $mobileContext, Skin $skin ) { + // MobileContext::getConfigVariable will soon be removed. + $hasGetConfigVariable = method_exists( $mobileContext, 'getConfigVariable' ); + // setSkinOptions is not available if ( $skin instanceof SkinMinerva ) { $skin->setSkinOptions( [ SkinMinerva::OPTIONS_MOBILE_BETA => $mobileContext->isBetaGroupMember(), SkinMinerva::OPTION_CATEGORIES - => $mobileContext->getConfigVariable( 'MinervaShowCategoriesButton' ), + => $hasGetConfigVariable ? + $mobileContext->getConfigVariable( 'MinervaShowCategoriesButton' ) : false, SkinMinerva::OPTION_BACK_TO_TOP - => $mobileContext->getConfigVariable( 'MinervaEnableBackToTop' ), + => $hasGetConfigVariable ? + $mobileContext->getConfigVariable( 'MinervaEnableBackToTop' ) : false, SkinMinerva::OPTION_TOGGLING => true, SkinMinerva::OPTION_MOBILE_OPTIONS => true, ] );