diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php index 8cded60..f686793 100644 --- a/includes/ServiceWiring.php +++ b/includes/ServiceWiring.php @@ -69,12 +69,25 @@ return [ // Feature: Languages in sidebar // ================================ - $featureManager->registerRequirement( - new DynamicConfigRequirement( - $services->getMainConfig(), - Constants::CONFIG_KEY_LANGUAGE_IN_HEADER, - Constants::REQUIREMENT_LANGUAGE_IN_HEADER - ) + $config = $services->getMainConfig(); + $languageInHeaderConfig = $config->get( Constants::CONFIG_KEY_LANGUAGE_IN_HEADER ); + + // Backwards compatibility with config variables that have been set in production. + if ( is_bool( $languageInHeaderConfig ) ) { + $languageInHeaderConfig = [ + 'logged_in' => $languageInHeaderConfig, + 'logged_out' => $languageInHeaderConfig, + ]; + } else { + $languageInHeaderConfig = [ + 'logged_in' => $languageInHeaderConfig['logged_in'] ?? false, + 'logged_out' => $languageInHeaderConfig['logged_out'] ?? false, + ]; + } + + $featureManager->registerSimpleRequirement( + Constants::REQUIREMENT_LANGUAGE_IN_HEADER, + $languageInHeaderConfig[ $context->getUser()->isRegistered() ? 'logged_in' : 'logged_out' ] ); $featureManager->registerFeature( diff --git a/skin.json b/skin.json index a522e0f..69d30b9 100644 --- a/skin.json +++ b/skin.json @@ -277,8 +277,11 @@ "value": false }, "VectorLanguageInHeader": { - "value": false, - "description": "@var boolean Moves the language links from the sidebar into a menu beside the page title. Also moves the indicators to the line below, next to the tagline (siteSub)." + "value": { + "logged_in": false, + "logged_out": false + }, + "description": "@var array Moves the language links from the sidebar into a menu beside the page title. Also moves the indicators to the line below, next to the tagline (siteSub)." }, "VectorDisableSidebarPersistence": { "value": false,