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
This commit is contained in:
jdlrobson 2018-02-05 13:15:34 -08:00
parent 1d609fdc6b
commit 97136f9d63
1 changed files with 7 additions and 2 deletions

View File

@ -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,
] );