From 244f871265569c559117e35a9f82857fc313ebb2 Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Thu, 10 Mar 2022 10:55:58 +0100 Subject: [PATCH 01/10] OEL-1307: Update to BCL 0.20.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e5cf9f5d..f5419c74 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "cweagans/composer-patches": "^1.7", "drupal/core": "^9.2", "drupal/twig_field_value": "^2.0", - "openeuropa/oe_bootstrap_theme": "^1.0.0-alpha7" + "openeuropa/oe_bootstrap_theme": "0.1307.202203100940" }, "require-dev": { "composer/installers": "^1.11", -- GitLab From df6d83cddadefcd7221e9f0538e863a31af9c115 Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Thu, 10 Mar 2022 10:56:17 +0100 Subject: [PATCH 02/10] OEL-1307: Fixing BCL 0.20.0 tests. --- tests/src/Kernel/AuthenticationBlockTest.php | 2 +- tests/src/Kernel/FooterBlockTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/src/Kernel/AuthenticationBlockTest.php b/tests/src/Kernel/AuthenticationBlockTest.php index 44160058..fe7f7325 100644 --- a/tests/src/Kernel/AuthenticationBlockTest.php +++ b/tests/src/Kernel/AuthenticationBlockTest.php @@ -59,7 +59,7 @@ class AuthenticationBlockTest extends KernelTestBase { $icon = $actual->filter('svg'); $this->assertSame('ms-2-5 bi icon--xs', $icon->attr('class')); $use = $icon->filter('use'); - $expected = '/themes/contrib/oe_bootstrap_theme/assets/icons/bootstrap-icons.svg#person-fill'; + $expected = '/themes/contrib/oe_bootstrap_theme/assets/icons/bcl-default-icons.svg#person-fill'; $this->assertSame($expected, $use->attr('xlink:href')); $link = $crawler->filter('a'); $this->assertSame('Log in', $link->text()); diff --git a/tests/src/Kernel/FooterBlockTest.php b/tests/src/Kernel/FooterBlockTest.php index 74d63e5c..1374dbe2 100644 --- a/tests/src/Kernel/FooterBlockTest.php +++ b/tests/src/Kernel/FooterBlockTest.php @@ -66,7 +66,7 @@ class FooterBlockTest extends SparqlKernelTestBase { $this->assertCount(1, $borderedSections); $sectionTitles = $crawler->filter('p.fw-bold.mb-2'); $this->assertCount(2, $sectionTitles); - $sectionLinks = $crawler->filter('div.col-12.col-lg-4:nth-child(2) a.text-underline-hover.d-block.mb-1'); + $sectionLinks = $crawler->filter('div.col-12.col-lg-4:nth-child(2) a.standalone.d-block.mb-1'); $this->assertCount(3, $sectionLinks); } @@ -102,7 +102,7 @@ class FooterBlockTest extends SparqlKernelTestBase { $this->assertCount(1, $borderedSections); $sectionTitles = $crawler->filter('p.fw-bold.mb-2'); $this->assertCount(5, $sectionTitles); - $sectionLinks = $crawler->filter('div.col-12.col-lg-4:nth-child(2) a.text-underline-hover.d-block.mb-1'); + $sectionLinks = $crawler->filter('div.col-12.col-lg-4:nth-child(2) a.standalone.d-block.mb-1'); $this->assertCount(10, $sectionLinks); } -- GitLab From ed44c3725e1e1b61ec5a28ff40aaed213610d7ac Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Thu, 10 Mar 2022 17:03:14 +0100 Subject: [PATCH 03/10] OEL-1307: Language modal BCL 0.20.0 update. --- oe_whitelabel.theme | 56 ++++++++++++ .../patterns/modal/modal-language.html.twig | 90 +------------------ tests/src/Kernel/MultilingualBlockTest.php | 8 +- 3 files changed, 60 insertions(+), 94 deletions(-) diff --git a/oe_whitelabel.theme b/oe_whitelabel.theme index 3da1f386..b07788c9 100644 --- a/oe_whitelabel.theme +++ b/oe_whitelabel.theme @@ -11,6 +11,62 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages; +/** + * Implements hook__preprocess_links__language_block(). + */ +function oe_whitelabel_preprocess_links__language_block(&$variables) { + $currentLanguage = \Drupal::languageManager()->getCurrentLanguage(); + $current_language_id = $currentLanguage->getId(); + $language_config_storage = \Drupal::entityTypeManager()->getStorage('configurable_language'); + $eu_links = []; + $non_eu_links = []; + + foreach ($variables['links'] as $language_code => $link) { + /** @var \Drupal\Core\Url $url */ + $url = $link['link']['#url']; + $href = $url + ->setOptions($link['link']['#options']) + ->setAbsolute(TRUE) + ->toString(); + $label = $link['link']['#title']; + + $link = [ + 'path' => $href, + 'name' => $label, + 'id' => 'link_' . $language_code, + 'label' => $label, + 'lang' => $language_code, + ]; + + if (!empty($current_language_id) && $language_code === $current_language_id) { + $variables['language']['link'] = $link; + $variables['language']['link']['target'] = 'languageModal'; + $link['active'] = TRUE; + } + + $language_config = $language_config_storage->load($language_code); + $category = $language_config->getThirdPartySetting('oe_multilingual', 'category'); + + if ($category === 'eu') { + $eu_links[$language_code] = $link; + } + else { + $non_eu_links[$language_code] = $link; + } + } + + $variables['language']['modal']['language_list'] = [ + 'overlay' => TRUE, + 'variant' => $variables['bcl_component_library'], + 'title' => t('Select your language'), + 'items' => $eu_links, + 'non_eu_items' => $non_eu_links, + 'icon_path' => $variables['bcl_icon_path'], + 'id' => 'languageModal', + 'size' => 'fullscreen', + ]; +} + /** * Implements hook_form_FORM_ID_alter() for facets_forms. */ diff --git a/templates/patterns/modal/modal-language.html.twig b/templates/patterns/modal/modal-language.html.twig index 5f0003b8..3ee20ce2 100644 --- a/templates/patterns/modal/modal-language.html.twig +++ b/templates/patterns/modal/modal-language.html.twig @@ -1,89 +1 @@ -{% spaceless %} -{# Parameters: - - modal - - id - - size - - header - - title - - label - - body - - links - - footer - - label -#} -{% if header %} - {% set _header %} - <h5 class="modal-title" id="languageeModalLabel">{{ header.title|default('Select your language'|t) }}</h5> - <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{{ header.label|default('Close'|t) }}"></button> - {% endset %} -{% endif %} - -{% if eu_links or non_eu_links %} - {% set _body %} - <div class="container"> - <div class="row"> - <div class="col col-lg-8 offset-lg-2"> - <h5 class="bcl-language__title">{{ 'EU official languages'|t }}</h5> - </div> - </div> - <div class="row"> - {% set _number_items = (eu_links|length / 2) %} - {% for link in eu_links|batch(_number_items) %} - {% if loop.index % 2 == 0 %} - <div class="col col-lg-4 offset-lg-2"> - {% else %} - <div class="col col-lg-4"> - {% endif %} - <div class="bcl-language__list"> - {% for id, data in link %} - <a id="{{ data.id }}" href="{{ data.href|default('#') }}" class="bcl-language__item">{{ data.name }}</a> - {% endfor %} - </div> - </div> - {% endfor %} - </div> - {% if non_eu_links %} - <div class="row"> - <div class="col col-lg-8 offset-lg-2"> - <h5 class="bcl-language__title">{{ 'Non EU languages'|t }}</h5> - </div> - </div> - <div class="row"> - {% set _number_items = (non_eu_links|length / 2) %} - {% for link in non_eu_links|batch(_number_items) %} - {% if loop.index % 2 == 0 %} - <div class="col col-lg-4 offset-lg-2"> - {% else %} - <div class="col col-lg-4"> - {% endif %} - <div class="bcl-language__list"> - {% for id, data in link %} - <a id="{{ data.id }}" href="{{ data.href|default('#') }}" class="bcl-language__item">{{ data.name }}</a> - {% endfor %} - </div> - </div> - {% endfor %} - </div> - {% endif %} - </div> - {% endset %} -{% endif %} - -{% if footer %} - {% set _footer %} - <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ header.label|default('Close'|t) }}</button> - {% endset %} -{% endif %} - -{% set _data = { - id: id, - size: size, - header: _header, - body: _body, - footer: _footer, -} %} - -<div class="bcl-language"> - {% include '@oe-bcl/bcl-modal/modal.html.twig' with _data only %} -</div> -{% endspaceless %} +{% include '@oe-bcl/bcl-language-list/language-list.html.twig' with language_list only %} diff --git a/tests/src/Kernel/MultilingualBlockTest.php b/tests/src/Kernel/MultilingualBlockTest.php index 8e21820e..2a313264 100644 --- a/tests/src/Kernel/MultilingualBlockTest.php +++ b/tests/src/Kernel/MultilingualBlockTest.php @@ -87,13 +87,11 @@ class MultilingualBlockTest extends KernelTestBase { $this->assertCount(1, $block); $link = $crawler->filter('div.language-switcher > a'); $this->assertSame('English', trim($link->text())); - $this->assertSame('http://localhost/en/%3Cnone%3E', $link->attr('href')); - $title = $crawler->filter('h5#languageeModalLabel'); + $this->assertSame('#', $link->attr('href')); + $title = $crawler->filter('div#languageModal h5'); $this->assertSame('Select your language', $title->text()); $button_header = $crawler->filter('button.btn-close'); - $this->assertSame('Close', $button_header->attr('aria-label')); - $button_close = $crawler->filter('button.btn.btn-secondary'); - $this->assertSame('Close', $button_close->text()); + $this->assertSame('modal', $button_header->attr('data-bs-dismiss')); $link_language = $crawler->filter('a#link_bg'); $this->assertSame('http://localhost/bg/%3Cnone%3E', $link_language->attr('href')); $this->assertSame('българÑки', $link_language->text()); -- GitLab From 4defec57a33bb1054280cd940615a3e9a788ce3a Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Wed, 16 Mar 2022 16:07:55 +0100 Subject: [PATCH 04/10] OEL-1307: Update to new oebt dev release. --- composer.json | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/composer.json b/composer.json index f5419c74..2b268cf2 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "cweagans/composer-patches": "^1.7", "drupal/core": "^9.2", "drupal/twig_field_value": "^2.0", - "openeuropa/oe_bootstrap_theme": "0.1307.202203100940" + "openeuropa/oe_bootstrap_theme": "0.1307.202203161735" }, "require-dev": { "composer/installers": "^1.11", @@ -67,11 +67,6 @@ } } }, - "patches": { - "openeuropa/oe_bootstrap_theme" : { - "1.x latest": "https://github.com/openeuropa/oe_bootstrap_theme/compare/1.0.0-alpha7..1.x.diff" - } - }, "drupal-scaffold": { "locations": { "web-root": "./build" -- GitLab From 7d035e34fd33cd47dad84d00a4c0cc0bd6ca3f46 Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Thu, 17 Mar 2022 12:43:26 +0100 Subject: [PATCH 05/10] OEL-1307: Upgrade the oe_whitelabel BCL version. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 28dbc3cf..3cd0fc2b 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "production": "npm-run-all build:*" }, "devDependencies": { - "@openeuropa/bcl-builder": "0.14.0", + "@openeuropa/bcl-builder": "0.20.0", "chokidar-cli": "^3.0.0", "copyfiles": "2.4.1", "cross-env": "7.0.3", -- GitLab From 71209dd70ef728f017fb64f79896159fdbc8c17c Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Fri, 18 Mar 2022 12:43:12 +0100 Subject: [PATCH 06/10] OEL-1307: Update the oe_bootstrap_theme release. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2b268cf2..39264682 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "cweagans/composer-patches": "^1.7", "drupal/core": "^9.2", "drupal/twig_field_value": "^2.0", - "openeuropa/oe_bootstrap_theme": "0.1307.202203161735" + "openeuropa/oe_bootstrap_theme": "0.1307.202203181216" }, "require-dev": { "composer/installers": "^1.11", -- GitLab From 9f67ebc29945ed7145fae2eb053ca3d8c09dbbab Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Mon, 21 Mar 2022 14:08:10 +0100 Subject: [PATCH 07/10] OEL-1307: Use the EuropeanLanguages internal language id in the language modal. --- oe_whitelabel.theme | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/oe_whitelabel.theme b/oe_whitelabel.theme index b07788c9..637f5943 100644 --- a/oe_whitelabel.theme +++ b/oe_whitelabel.theme @@ -17,6 +17,10 @@ use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages; function oe_whitelabel_preprocess_links__language_block(&$variables) { $currentLanguage = \Drupal::languageManager()->getCurrentLanguage(); $current_language_id = $currentLanguage->getId(); + $language_internal = $current_language_id; + if (EuropeanUnionLanguages::hasLanguage($current_language_id)) { + $language_internal = EuropeanUnionLanguages::getInternalLanguageCode($current_language_id); + } $language_config_storage = \Drupal::entityTypeManager()->getStorage('configurable_language'); $eu_links = []; $non_eu_links = []; @@ -35,7 +39,7 @@ function oe_whitelabel_preprocess_links__language_block(&$variables) { 'name' => $label, 'id' => 'link_' . $language_code, 'label' => $label, - 'lang' => $language_code, + 'lang' => $language_internal, ]; if (!empty($current_language_id) && $language_code === $current_language_id) { -- GitLab From 63b13ed919114ac35d1830832a6f11a83d482648 Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Mon, 28 Mar 2022 17:51:02 +0200 Subject: [PATCH 08/10] OEL-1307: Move language_modal to oe_whitelabel_multilingual module. --- composer.json | 2 +- .../oe_whitelabel_multilingual.module | 27 +++++---- oe_whitelabel.theme | 60 ------------------- 3 files changed, 16 insertions(+), 73 deletions(-) diff --git a/composer.json b/composer.json index 39264682..5cc5c27f 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "cweagans/composer-patches": "^1.7", "drupal/core": "^9.2", "drupal/twig_field_value": "^2.0", - "openeuropa/oe_bootstrap_theme": "0.1307.202203181216" + "openeuropa/oe_bootstrap_theme": "0.1307.202203281705" }, "require-dev": { "composer/installers": "^1.11", diff --git a/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.module b/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.module index 203182b5..1dc9264e 100755 --- a/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.module +++ b/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.module @@ -8,6 +8,7 @@ declare(strict_types = 1); use Drupal\Component\Utility\Html; +use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages; /** * Implements hook_preprocess_links(). @@ -70,6 +71,10 @@ function oe_whitelabel_multilingual_preprocess_links__oe_multilingual_content_la function oe_whitelabel_multilingual_preprocess_links__language_block(&$variables) { $currentLanguage = \Drupal::languageManager()->getCurrentLanguage(); $current_language_id = $currentLanguage->getId(); + $language_internal = $current_language_id; + if (EuropeanUnionLanguages::hasLanguage($current_language_id)) { + $language_internal = EuropeanUnionLanguages::getInternalLanguageCode($current_language_id); + } $language_config_storage = \Drupal::entityTypeManager()->getStorage('configurable_language'); $eu_links = []; $non_eu_links = []; @@ -84,10 +89,11 @@ function oe_whitelabel_multilingual_preprocess_links__language_block(&$variables $label = $link['link']['#title']; $link = [ - 'href' => $href, + 'path' => $href, 'name' => $label, 'id' => 'link_' . $language_code, - 'hreflang' => $language_code, + 'label' => $label, + 'lang' => $language_internal, ]; if (!empty($current_language_id) && $language_code === $current_language_id) { @@ -107,17 +113,14 @@ function oe_whitelabel_multilingual_preprocess_links__language_block(&$variables } } - $variables['language']['modal'] = [ + $variables['language']['modal']['language_list'] = [ + 'overlay' => TRUE, + 'variant' => $variables['bcl_component_library'], + 'title' => t('Select your language'), + 'items' => $eu_links, + 'non_eu_items' => $non_eu_links, + 'icon_path' => $variables['bcl_icon_path'], 'id' => 'languageModal', 'size' => 'fullscreen', - 'header' => [ - 'title' => t('Select your language'), - 'label' => t('Close'), - ], - 'eu_links' => $eu_links, - 'non_eu_links' => $non_eu_links, - 'footer' => [ - 'label' => t('Close'), - ], ]; } diff --git a/oe_whitelabel.theme b/oe_whitelabel.theme index 637f5943..3da1f386 100644 --- a/oe_whitelabel.theme +++ b/oe_whitelabel.theme @@ -11,66 +11,6 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages; -/** - * Implements hook__preprocess_links__language_block(). - */ -function oe_whitelabel_preprocess_links__language_block(&$variables) { - $currentLanguage = \Drupal::languageManager()->getCurrentLanguage(); - $current_language_id = $currentLanguage->getId(); - $language_internal = $current_language_id; - if (EuropeanUnionLanguages::hasLanguage($current_language_id)) { - $language_internal = EuropeanUnionLanguages::getInternalLanguageCode($current_language_id); - } - $language_config_storage = \Drupal::entityTypeManager()->getStorage('configurable_language'); - $eu_links = []; - $non_eu_links = []; - - foreach ($variables['links'] as $language_code => $link) { - /** @var \Drupal\Core\Url $url */ - $url = $link['link']['#url']; - $href = $url - ->setOptions($link['link']['#options']) - ->setAbsolute(TRUE) - ->toString(); - $label = $link['link']['#title']; - - $link = [ - 'path' => $href, - 'name' => $label, - 'id' => 'link_' . $language_code, - 'label' => $label, - 'lang' => $language_internal, - ]; - - if (!empty($current_language_id) && $language_code === $current_language_id) { - $variables['language']['link'] = $link; - $variables['language']['link']['target'] = 'languageModal'; - $link['active'] = TRUE; - } - - $language_config = $language_config_storage->load($language_code); - $category = $language_config->getThirdPartySetting('oe_multilingual', 'category'); - - if ($category === 'eu') { - $eu_links[$language_code] = $link; - } - else { - $non_eu_links[$language_code] = $link; - } - } - - $variables['language']['modal']['language_list'] = [ - 'overlay' => TRUE, - 'variant' => $variables['bcl_component_library'], - 'title' => t('Select your language'), - 'items' => $eu_links, - 'non_eu_items' => $non_eu_links, - 'icon_path' => $variables['bcl_icon_path'], - 'id' => 'languageModal', - 'size' => 'fullscreen', - ]; -} - /** * Implements hook_form_FORM_ID_alter() for facets_forms. */ -- GitLab From 02e33e2767128b55306b937709daf69fdd623c9d Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Mon, 28 Mar 2022 18:24:37 +0200 Subject: [PATCH 09/10] OEL-1307: Change calendar icon on event node template. --- .../templates/node--oe-sc-event--full.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/oe_whitelabel_starter_event/templates/node--oe-sc-event--full.html.twig b/modules/oe_whitelabel_starter_event/templates/node--oe-sc-event--full.html.twig index 9df36039..faecb1a7 100755 --- a/modules/oe_whitelabel_starter_event/templates/node--oe-sc-event--full.html.twig +++ b/modules/oe_whitelabel_starter_event/templates/node--oe-sc-event--full.html.twig @@ -13,7 +13,7 @@ { term:[{ 'label': content.oe_sc_event_dates|field_label, - 'icon': 'calendar-event', + 'icon': 'calendar-fill', }], definition: _event_dates, } -- GitLab From 14e61d4b4a2492371755372acf50e2d1788468df Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Tue, 29 Mar 2022 09:24:21 +0200 Subject: [PATCH 10/10] OEL-1307: Upgrade oebt release. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5cc5c27f..0017f449 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "cweagans/composer-patches": "^1.7", "drupal/core": "^9.2", "drupal/twig_field_value": "^2.0", - "openeuropa/oe_bootstrap_theme": "0.1307.202203281705" + "openeuropa/oe_bootstrap_theme": "0.1.202203290731" }, "require-dev": { "composer/installers": "^1.11", -- GitLab