diff --git a/composer.json b/composer.json index e5cf9f5df20e150e7accec5163c41cdb56d31fed..0017f4492c9f30c1aec8593766a4b6ca1ee4fe3a 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.1.202203290731" }, "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" diff --git a/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.module b/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.module index 203182b58c16d7c40216aa5ad50d05c5e4734196..1dc9264e18018eb5f766cd521a7382da0ec50495 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/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 9df36039072a229866d1764c0c53abe9190383c2..faecb1a7c07fc73df0b36bf25c8499882ce55de7 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, } diff --git a/package.json b/package.json index 28dbc3cf4ffb35ae3cc5cbd0523f37408108767a..3cd0fc2ba2f755d977ee429e8bac2eb8765903f8 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", diff --git a/templates/patterns/modal/modal-language.html.twig b/templates/patterns/modal/modal-language.html.twig index 5f0003b8bd045917a0ace0bf3a43d618fc20c3af..3ee20ce2bf49424f15dbbf660a683165455b56b5 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/AuthenticationBlockTest.php b/tests/src/Kernel/AuthenticationBlockTest.php index 441600587c136ddba9958d4d79fe319281739acd..fe7f73258117c67acbb40234037b1fe1b2517a48 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 74d63e5c172616e70a5a0ae659c6ed2201217036..1374dbe24c03cc3ab9e8750a05aec6bdc78230c4 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); } diff --git a/tests/src/Kernel/MultilingualBlockTest.php b/tests/src/Kernel/MultilingualBlockTest.php index 8e21820ebb44726694206d574f27ef9cb2bf09a1..2a313264bf796f8dfb870f8b04f646380bff4b86 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());