From 3aa5896673d6599bbcdca821fdb90b18cc1d860e Mon Sep 17 00:00:00 2001
From: escuriola <escuriola@gmail.com>
Date: Fri, 18 Feb 2022 19:10:57 +0100
Subject: [PATCH] OEL-1160: Remove branding page template. Put all header in
 page template.

---
 .../page/page--bcl-branding.html.twig         | 94 -------------------
 templates/overrides/page/page.html.twig       | 72 +++++++++-----
 2 files changed, 49 insertions(+), 117 deletions(-)
 delete mode 100644 templates/overrides/page/page--bcl-branding.html.twig

diff --git a/templates/overrides/page/page--bcl-branding.html.twig b/templates/overrides/page/page--bcl-branding.html.twig
deleted file mode 100644
index 39c4c011..00000000
--- a/templates/overrides/page/page--bcl-branding.html.twig
+++ /dev/null
@@ -1,94 +0,0 @@
-{#
-/**
- * @file
- * Overrides single page template for BCL branding.
- *
- * Add additional information to 'site_header_container' and 'navigation' blocks.
- *
- * @see ./oe_theme/templates/layout/page.html.twig
- */
-#}
-{% extends "page.html.twig" %}
-{%
-  set name_classes = [
-  'text-decoration-none',
-  'align-bottom',
-  bcl_header_style == 'light' ? 'text-dark': 'text-white',
-]
-%}
-{% set _site_name_classes = 'bcl-header__site-name' %}
-{% if bcl_component_library == 'neutral' %}
-  {% set _site_name_classes = 'bcl-header__site-name h5 d-inline-block d-lg-none' %}
-{% endif %}
-{% set site_name_attr = create_attribute() %}
-{% set light = bcl_header_style == 'light' %}
-{% set _site_name %}
-  <a {{ site_name_attr.addClass(name_classes).setAttribute('rel', 'Home') }} href="{{ path('<front>') }}">
-    {{ site_name }}
-  </a>
-{% endset %}
-{% block header %}
-  {% set attributes = create_attribute() %}
-
-  {% set attributes = attributes.addClass(['bcl-header', 'bcl-header--' ~ bcl_component_library]) %}
-
-  {% set project_classes = 'bcl-header__project' %}
-  {% if light is not empty %}
-    {% set project_classes = project_classes ~ ' light' %}
-  {% endif %}
-
-  <header {{ attributes }}>
-      {% block head %}
-        {{ pattern('navbar', {
-          navigation: page.navbar_branding,
-          right: page.navbar_right,
-          color_scheme: 'light',
-          background: false,
-          attributes: create_attribute().addClass(['w-100', 'shadow-sm']),
-        }) }}
-      {% endblock %}
-    <!-- project name -->
-    {% if project_logo is not empty or site_name is not empty %}
-      <div class="{{ project_classes }}">
-        <div class="container">
-          {% if project_logo is not empty and bcl_component_library != 'neutral' %}
-            <img
-              {% if project_logo.path is not empty %}
-                src="{{ project_logo.path }}"
-              {% endif %}
-              {% if project_logo.alt is not empty %}
-                alt="{{ project_logo.alt }}"
-              {% endif %}
-              {% if project_logo.classes is not empty %}
-                class="{{ project_logo.classes }}"
-              {% endif %}
-            />
-          {% endif %}
-          {% if _site_name is not empty %}
-            <div class="{{ _site_name_classes }}">
-              {{- _site_name -}}
-            </div>
-          {% endif %}
-        </div>
-      </div>
-    {% endif %}
-
-    <!-- navbar -->
-      {% block navbar %}
-        {{ pattern('navbar', {
-          navigation: page.header_left,
-          right: page.header_right,
-          color_scheme: 'dark',
-          background: false,
-          expanded_breakpoint: 'lg',
-          attributes: create_attribute().addClass(['bcl-header__navbar']),
-        }) }}
-      {% endblock %}
-    <!-- breadcrumbs -->
-      <div class="container">
-        {% block breadcrumbs %}
-          {{ page.breadcrumbs }}
-        {% endblock %}
-      </div>
-  </header>
-{% endblock %}
diff --git a/templates/overrides/page/page.html.twig b/templates/overrides/page/page.html.twig
index 01fe31d7..ce63a6f2 100644
--- a/templates/overrides/page/page.html.twig
+++ b/templates/overrides/page/page.html.twig
@@ -47,32 +47,58 @@
  * @ingroup themeable
  */
 #}
-
-{% set _head = pattern('navbar', {
-  navigation: page.navbar_branding,
-  right: page.navbar_right,
-  color_scheme: 'light',
-  background: false,
-  attributes: create_attribute().addClass(['w-100', 'shadow-sm']),
-}) %}
-
-{% set _navbar = pattern('navbar', {
-  navigation: page.header_left,
-  right: page.header_right,
-  color_scheme: 'dark',
-  background: false,
-  expanded_breakpoint: 'lg',
-  attributes: create_attribute().addClass(['bcl-header__navbar']),
-}) %}
+{% set corporate_logos %}
+  <a class="navbar-brand" target="_blank" href="{{ site_logo_href }}">
+    {% if bcl_component_library == 'eu' %}
+      <picture>
+        <source media="(max-width: 992px)"
+                srcset="{{ bcl_logo_path ~ 'eu/mobile/logo-eu--' ~ current_language_id|to_internal_language_id ~ '.svg' }}">
+        <img src="{{ bcl_logo_path ~ 'eu/logo-eu--' ~ current_language_id|to_internal_language_id ~ '.svg' }}"
+             alt="{{ site_logo_alt }}" title="{{ site_logo_title }}"/>
+      </picture>
+    {% elseif bcl_component_library == 'ec' %}
+      <img src="{{ bcl_logo_path ~ 'ec/logo-ec--' ~ current_language_id|to_internal_language_id ~ '.svg' }}"
+      alt="{{ site_logo_alt }}" title="{{ site_logo_title }}" />
+    {% else %}
+      <img src="{{ site_logo }}" alt="{{ site_logo_alt }}" title="{{ site_logo_title }}"/>
+      <div class="h5 ms-4-5 d-none d-lg-inline-block">{{ site_name }}</div>
+    {% endif %}</a>
+{% endset %}
 
 <div class="page">
   {% block header %}
-    {{ pattern('navbar', {
-      navbar_branding: page.navbar_branding ? page.navbar_branding : false,
-      navbar_left: page.navbar_left ? page.navbar_left : false,
-      navbar_right: page.navbar_right ? page.navbar_right : false,
-      color_set: 'light'
-    }) }}
+    {% set attributes = create_attribute().addClass(['bcl-header', 'bcl-header--' ~ bcl_component_library]) %}
+    <header {{ attributes }}>
+      {% block head %}
+        {{ pattern('navbar', {
+          navigation: corporate_logos,
+          right: page.navbar_right,
+          color_scheme: 'light',
+          background: false,
+          attributes: create_attribute().addClass(['w-100', 'shadow-sm']),
+        }) }}
+      {% endblock %}
+
+      {{ page.navbar_branding }}
+
+      <!-- navbar -->
+      {% block navbar %}
+        {{ pattern('navbar', {
+          navigation: page.header_left,
+          right: page.header_right,
+          color_scheme: 'dark',
+          background: false,
+          expanded_breakpoint: 'lg',
+          attributes: create_attribute().addClass(['bcl-header__navbar']),
+        }) }}
+      {% endblock %}
+      <!-- breadcrumbs -->
+      <div class="container">
+        {% block breadcrumbs %}
+          {{ page.breadcrumbs }}
+        {% endblock %}
+      </div>
+    </header>
   {% endblock %}
   <main>
     {% if page.header %}
-- 
GitLab