From 822a297e36aed5a09806bfbcd4f99597231d666e Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 7 Oct 2025 10:18:37 +0200 Subject: [PATCH] Create config for adding environment banner --- config/packages/chill.yaml | 7 +++++++ .../DependencyInjection/ChillMainExtension.php | 6 ++++++ .../DependencyInjection/Configuration.php | 14 ++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/config/packages/chill.yaml b/config/packages/chill.yaml index 6ed6b6984..e5974a6bc 100644 --- a/config/packages/chill.yaml +++ b/config/packages/chill.yaml @@ -1,6 +1,13 @@ chill_main: available_languages: [ '%env(resolve:LOCALE)%', 'en' ] available_countries: ['BE', 'FR'] + top_banner: + visible: true + text: + fr: 'Vous travaillez actuellement avec la version de PRÉ-PRODUCTION.' + nl: 'Je werkt momenteel in de PRE-PRODUCTIE versie' + color: '#353535' + background_color: '#d8bb48' notifications: from_email: '%env(resolve:NOTIFICATION_FROM_EMAIL)%' from_name: '%env(resolve:NOTIFICATION_FROM_NAME)%' diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 70f0df071..ebb28d2e7 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -205,6 +205,11 @@ class ChillMainExtension extends Extension implements [] ); + $container->setParameter( + 'chill_main.top_banner', + $config['top_banner'] ?? [] + ); + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config')); $loader->load('services.yaml'); $loader->load('services/doctrine.yaml'); @@ -250,6 +255,7 @@ class ChillMainExtension extends Extension implements 'name' => $config['installation_name'], ], 'available_languages' => $config['available_languages'], 'add_address' => $config['add_address'], + 'chill_main_config' => $config, ], 'form_themes' => ['@ChillMain/Form/fields.html.twig'], ]; diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php index 6625488dd..a3247d88e 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php @@ -168,6 +168,20 @@ class Configuration implements ConfigurationInterface ->end() ->end() ->end() + ->arrayNode('top_banner') + ->canBeUnset() + ->children() + ->booleanNode('visible') + ->defaultFalse() + ->end() + ->arrayNode('text') + ->useAttributeAsKey('lang') + ->scalarPrototype()->end() + ->end() // end of text + ->scalarNode('color')->defaultNull()->end() + ->scalarNode('background_color')->defaultNull()->end() + ->end() // end of top_banner children + ->end() // end of top_banner ->arrayNode('widgets') ->canBeEnabled() ->canBeUnset()