From a0929007c2ab20fd7df272daf276912d332ddd87 Mon Sep 17 00:00:00 2001
From: Abel Santos <abel.santos.corral@gmail.com>
Date: Mon, 13 Sep 2021 11:12:10 +0200
Subject: [PATCH] OEL-452: Save progress. Eliminated use of module and set all
 in theme.

---
 composer.json                                    |  1 +
 .../oe_whitelabel_multilingual.info.yml          |  7 -------
 oe_whitelabel.theme                              | 16 ++++++++++++++++
 runner.yml.dist                                  |  1 +
 .../navigation/links--language-block.html.twig   | 10 ++++++++++
 5 files changed, 28 insertions(+), 7 deletions(-)
 delete mode 100644 modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.info.yml
 create mode 100644 oe_whitelabel.theme
 create mode 100644 templates/overrides/navigation/links--language-block.html.twig

diff --git a/composer.json b/composer.json
index 8d3b0471..8a91dcdc 100644
--- a/composer.json
+++ b/composer.json
@@ -12,6 +12,7 @@
         "drupal/ui_patterns_settings": "^1.0",
         "openeuropa/oe_bootstrap_theme": "0.100920211846",
         "openeuropa/oe_authentication": "^1.4",
+        "openeuropa/oe_multilingual": "^1.8",
         "php": ">=7.3"
     },
     "require-dev": {
diff --git a/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.info.yml b/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.info.yml
deleted file mode 100644
index b60355b1..00000000
--- a/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.info.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-name: OpenEuropa Whitelabel Multilingual
-type: module
-description: Provides multilingual management and theming for OpenEuropa Whitelabel.
-package: OpenEuropa Whitelabel Theme
-core_version_requirement: ^8.9 || ^9.1
-dependencies:
-  - openeuropa:oe_multilingual
diff --git a/oe_whitelabel.theme b/oe_whitelabel.theme
new file mode 100644
index 00000000..39bb8c11
--- /dev/null
+++ b/oe_whitelabel.theme
@@ -0,0 +1,16 @@
+<?php
+
+/**
+ * @file
+ * Functions to support theming.
+ */
+
+declare(strict_types = 1);
+
+/**
+ * Implements hook__preprocess_links__language_block().
+ */
+function oe_whitelabel_preprocess_links__language_block() {
+  /** @var \Drupal\Core\Language\LanguageInterface[] $original_languages */
+  $original_languages = \Drupal::service('language_manager')->getNativeLanguages();
+}
diff --git a/runner.yml.dist b/runner.yml.dist
index 8e145100..3b34e709 100644
--- a/runner.yml.dist
+++ b/runner.yml.dist
@@ -15,6 +15,7 @@ drupal:
     - "./vendor/bin/drush en ui_patterns ui_patterns_library ui_patterns_settings components -y"
     - "./vendor/bin/drush en field_ui -y"
     - "./vendor/bin/drush en toolbar -y"
+    - "./vendor/bin/drush en oe_multilingual -y"
     - "./vendor/bin/drush theme:enable oe_whitelabel -y"
     - "./vendor/bin/drush en oe_whitelabel_helper -y"
     - "./vendor/bin/drush theme:enable seven -y"
diff --git a/templates/overrides/navigation/links--language-block.html.twig b/templates/overrides/navigation/links--language-block.html.twig
new file mode 100644
index 00000000..defc1c16
--- /dev/null
+++ b/templates/overrides/navigation/links--language-block.html.twig
@@ -0,0 +1,10 @@
+<a class="nav-link" href={{ current_language.label }} role="button" data-bs-toggle="modal" data-bs-target="#{{ current_language.target }}">
+  {{ pattern('icon', {
+     name: 'chat-left-dots-fill'
+   }) }}
+  {{ current_language.label }}
+</a>
+{# {{ pattern('modal', {
+  'header' => 'Select your language'|t,
+  'body' => languages
+}) }} #}
-- 
GitLab