Merge "Add config for language in header for logged in/out users"
This commit is contained in:
commit
e637cef2c2
|
@ -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(
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue