diff --git a/oe_whitelabel.theme b/oe_whitelabel.theme index 11537821c93519e177e82485d5f297d3ac52ce32..230dbc9325ba08a6f0ef78e37c454cd5f1a8a940 100644 --- a/oe_whitelabel.theme +++ b/oe_whitelabel.theme @@ -91,3 +91,26 @@ function oe_whitelabel_form_facets_form_alter(&$form, FormStateInterface $form_s } } } + +/** + * Implements hook_form_FORM_ID_alter(). + */ +function oe_whitelabel_form_system_theme_settings_alter(&$form, FormStateInterface &$form_state, $form_id = NULL) { + $form['component_library'] = [ + '#type' => 'select', + '#title' => t('Component library'), + '#options' => [ + 'ec' => t('European Commission'), + 'eu' => t('European Union'), + ], + '#default_value' => theme_get_setting('component_library'), + '#description' => t('Choose "European Commission" for websites hosted under the ec.europa.eu domain and "European Union" for websites hosted under the europa.eu domain.'), + ]; +} + +/** + * Implements hook_preprocess(). + */ +function oe_whitelabel_preprocess(&$variables) { + $variables['bcl_component_library'] = theme_get_setting('component_library'); +} diff --git a/templates/overrides/page/page.html.twig b/templates/overrides/page/page.html.twig index 125863222911d8816f8bb079f2f400053d53f422..19b050ef1e34adc9958d2a6a17a717b27d0433d2 100644 --- a/templates/overrides/page/page.html.twig +++ b/templates/overrides/page/page.html.twig @@ -97,7 +97,7 @@ </main> {% if page.footer %} - {% if "ecfooterblock" in page.footer|keys %} + {% if bcl_component_library == 'ec' %} <footer class="ec__footer bcl-footer mt-4"> {% else %} <footer class="bcl-footer mt-4"> diff --git a/templates/patterns/header_nav/pattern-header_nav.html.twig b/templates/patterns/header_nav/pattern-header_nav.html.twig index 7de0c89c46979bdf22ecdce9e8c30a31fd031794..40c011f4999337201f5631abb5acb2467d151a08 100644 --- a/templates/patterns/header_nav/pattern-header_nav.html.twig +++ b/templates/patterns/header_nav/pattern-header_nav.html.twig @@ -1,4 +1,4 @@ -{% if 'corporateeclogoblock' in navbar_branding|keys %} +{% if bcl_component_library == 'ec' %} <header class="ec__header bcl-header"> {% else %} <header class="bcl-header">