From e85595644357dcaab2538bae366da15c61d67597 Mon Sep 17 00:00:00 2001 From: Francesco Sardara <francesco@tdgwebservices.com> Date: Sat, 26 Mar 2022 01:09:43 +0100 Subject: [PATCH 1/8] OEL-494: Use current ticket patch for oe_bootstrap_theme. --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index f8c79040..c164ba11 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.1.202203290731" + "openeuropa/oe_bootstrap_theme": "0.1317.202203291220" }, "require-dev": { "composer/installers": "^1.11", @@ -72,7 +72,7 @@ }, "patches": { "openeuropa/oe_bootstrap_theme" : { - "1.x latest": "https://github.com/openeuropa/oe_bootstrap_theme/compare/0.1.202203290731..1.x.diff" + "OEL-494": "https://github.com/openeuropa/oe_bootstrap_theme/compare/0.1317.202203291220..OEL-494-v2.diff" } }, "drupal-scaffold": { -- GitLab From d7f0457b7044e4cee1f1563f710d86a7e109466d Mon Sep 17 00:00:00 2001 From: Francesco Sardara <francesco@tdgwebservices.com> Date: Sat, 26 Mar 2022 01:10:01 +0100 Subject: [PATCH 2/8] OEL-494: Setup private file path to use oe_media_document. --- runner.yml.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/runner.yml.dist b/runner.yml.dist index 17e68fd1..78ae4aaa 100644 --- a/runner.yml.dist +++ b/runner.yml.dist @@ -41,6 +41,7 @@ drupal: - "bower_components" - "vendor" - "${drupal.root}" + file_private_path: 'sites/default/files/private' databases: sparql_default: default: -- GitLab From a74028ae230e7813aa30c37f376e4c49c3ed5bd6 Mon Sep 17 00:00:00 2001 From: Francesco Sardara <francesco@tdgwebservices.com> Date: Sat, 26 Mar 2022 01:11:34 +0100 Subject: [PATCH 3/8] OEL-494: Style the default view mode of document media. --- composer.json | 5 + oe_whitelabel.theme | 31 ++++++ src/DocumentMediaWrapper.php | 104 ++++++++++++++++++ .../media/media--document--default.html.twig | 14 +++ 4 files changed, 154 insertions(+) create mode 100644 src/DocumentMediaWrapper.php create mode 100644 templates/media/media--document--default.html.twig diff --git a/composer.json b/composer.json index c164ba11..0d80aac1 100644 --- a/composer.json +++ b/composer.json @@ -59,6 +59,11 @@ "url": "https://github.com/openeuropa/oe_starter_content" } }, + "autoload": { + "psr-4": { + "Drupal\\oe_whitelabel\\": "./src/" + } + }, "extra": { "composer-exit-on-patch-failure": true, "enable-patching": true, diff --git a/oe_whitelabel.theme b/oe_whitelabel.theme index 5da6c190..d6ecce13 100644 --- a/oe_whitelabel.theme +++ b/oe_whitelabel.theme @@ -9,6 +9,7 @@ declare(strict_types = 1); use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; +use Drupal\oe_whitelabel\DocumentMediaWrapper; use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages; // Include all files from the includes directory. @@ -137,3 +138,33 @@ function oe_whitelabel_preprocess_page(&$variables) { } $variables['site_logo_href'] = $site_logo_href; } + +/** + * Implements hook_preprocess_HOOK() for document media bundle. + */ +function oe_whitelabel_preprocess_media__document__default(&$variables) { + /** @var \Drupal\media\Entity\Media $media */ + $media = $variables['media']; + + $wrapper = new DocumentMediaWrapper($media); + if ($wrapper->isEmpty()) { + return; + } + + $variables['file'] = $wrapper->toFileValueObject(); + + // Generate the file information for all available translations. + foreach ($media->getTranslationLanguages() as $langcode => $language) { + // We don't want to include the information of the current language again. + if ($media->language()->getId() === $langcode) { + continue; + } + + $translation = $media->getTranslation($langcode); + $wrapper = new DocumentMediaWrapper($translation); + if ($wrapper->isEmpty()) { + continue; + } + $variables['translations'][] = $wrapper->toFileValueObject(); + } +} diff --git a/src/DocumentMediaWrapper.php b/src/DocumentMediaWrapper.php new file mode 100644 index 00000000..0bc4ef27 --- /dev/null +++ b/src/DocumentMediaWrapper.php @@ -0,0 +1,104 @@ +<?php + +declare(strict_types = 1); + +namespace Drupal\oe_whitelabel; + +use Drupal\Core\Field\FieldItemListInterface; +use Drupal\media\MediaInterface; +use Drupal\oe_bootstrap_theme\ValueObject\FileValueObject; + +/** + * Wraps a media entity of bundle "document". + */ +class DocumentMediaWrapper { + + /** + * The media. + * + * @var \Drupal\media\MediaInterface + */ + protected MediaInterface $media; + + /** + * Construct a new wrapper object. + * + * @param \Drupal\media\MediaInterface $media + * The media to wrap. + */ + public function __construct(MediaInterface $media) { + if ($media->bundle() !== 'document') { + throw new \InvalidArgumentException(sprintf('Invalid media of type "%s" passed, "document" expected.', $media->bundle())); + } + + $this->media = $media; + } + + /** + * Returns if the media is empty. + * + * A media is considered empty if the current active field, based on the type, + * is empty. + * + * @return bool + * Whether the media is referencing a field or not. + */ + public function isEmpty(): bool { + $field = $this->getActiveField(); + return !$field || $field->isEmpty(); + } + + /** + * Returns the type of the media. + * + * @return string|null + * The media type, usually "remote" or "local". NULL if no value set. + */ + public function getType(): ?string { + return $this->media->get('oe_media_file_type')->value; + } + + /** + * Creates a file value object from the current media values. + * + * @return \Drupal\oe_bootstrap_theme\ValueObject\FileValueObject|null + * A file value object, or NULL if the media is empty. + */ + public function toFileValueObject(): ?FileValueObject { + if ($this->isEmpty()) { + return NULL; + } + + $field = $this->getActiveField(); + $object = $this->getType() === 'remote' + ? FileValueObject::fromFileLink($field->first()) + : FileValueObject::fromFileEntity($field->first()->entity); + + return $object->setTitle($this->media->getName()) + ->setLanguageCode($this->media->language()->getId()); + } + + /** + * Returns the field that is being used for the document, based on the type. + * + * @return \Drupal\Core\Field\FieldItemListInterface|null + * The field item list, or NULL if an invalid type is specified. + */ + protected function getActiveField(): ?FieldItemListInterface { + if (!$this->getType()) { + return NULL; + } + + switch ($this->getType()) { + case 'remote': + return $this->media->get('oe_media_remote_file'); + + case 'local': + return $this->media->get('oe_media_file'); + + default: + return NULL; + } + } + +} diff --git a/templates/media/media--document--default.html.twig b/templates/media/media--document--default.html.twig new file mode 100644 index 00000000..dcaaf033 --- /dev/null +++ b/templates/media/media--document--default.html.twig @@ -0,0 +1,14 @@ +{# +/** + * @file + * Theme override to display a media item. + * + * @see ./core/themes/stable/templates/content/media.html.twig + */ +#} +{% if file %} + {{ pattern('file', { + file: file, + translations: translations, + }) }} +{% endif %} -- GitLab From 051ddd6c9ea9d8423072d1ce068658e80f3010f4 Mon Sep 17 00:00:00 2001 From: Francesco Sardara <francesco@tdgwebservices.com> Date: Fri, 1 Apr 2022 17:15:18 +0200 Subject: [PATCH 4/8] OEL-494: Add patch to oe_paragraphs to fix the view mode of document paragraph. --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 0d80aac1..33bf9fa5 100644 --- a/composer.json +++ b/composer.json @@ -78,6 +78,9 @@ "patches": { "openeuropa/oe_bootstrap_theme" : { "OEL-494": "https://github.com/openeuropa/oe_bootstrap_theme/compare/0.1317.202203291220..OEL-494-v2.diff" + }, + "openeuropa/oe_paragraphs": { + "OEL-494": "https://github.com/openeuropa/oe_paragraphs/compare/1.12.0..OEL-494.diff" } }, "drupal-scaffold": { -- GitLab From ddc4c683ad8b1c8bb96ede4356ce0170c3a538ef Mon Sep 17 00:00:00 2001 From: Francesco Sardara <francesco@tdgwebservices.com> Date: Fri, 1 Apr 2022 17:15:56 +0200 Subject: [PATCH 5/8] OEL-494: Mark class as internal to warn developers that the API is not final yet. --- src/DocumentMediaWrapper.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/DocumentMediaWrapper.php b/src/DocumentMediaWrapper.php index 0bc4ef27..b486b3b8 100644 --- a/src/DocumentMediaWrapper.php +++ b/src/DocumentMediaWrapper.php @@ -10,6 +10,8 @@ use Drupal\oe_bootstrap_theme\ValueObject\FileValueObject; /** * Wraps a media entity of bundle "document". + * + * @internal */ class DocumentMediaWrapper { -- GitLab From d6aaabe5f72a899a5f4d2a617308f0966642f19d Mon Sep 17 00:00:00 2001 From: Francesco Sardara <francesco@tdgwebservices.com> Date: Fri, 1 Apr 2022 17:16:48 +0200 Subject: [PATCH 6/8] OEL-494: Add test coverage for the document paragraph rendering. --- composer.json | 6 + .../Paragraphs/DocumentParagraphTest.php | 234 ++++++++++++++++++ 2 files changed, 240 insertions(+) create mode 100644 modules/oe_whitelabel_paragraphs/tests/src/Kernel/Paragraphs/DocumentParagraphTest.php diff --git a/composer.json b/composer.json index 33bf9fa5..b730ebc1 100644 --- a/composer.json +++ b/composer.json @@ -64,6 +64,12 @@ "Drupal\\oe_whitelabel\\": "./src/" } }, + "autoload-dev": { + "psr-4": { + "Drupal\\Tests\\oe_whitelabel\\": "./tests/src/", + "Drupal\\Tests\\oe_bootstrap_theme\\": "./build/themes/contrib/oe_bootstrap_theme/tests/src/" + } + }, "extra": { "composer-exit-on-patch-failure": true, "enable-patching": true, diff --git a/modules/oe_whitelabel_paragraphs/tests/src/Kernel/Paragraphs/DocumentParagraphTest.php b/modules/oe_whitelabel_paragraphs/tests/src/Kernel/Paragraphs/DocumentParagraphTest.php new file mode 100644 index 00000000..7ca6a792 --- /dev/null +++ b/modules/oe_whitelabel_paragraphs/tests/src/Kernel/Paragraphs/DocumentParagraphTest.php @@ -0,0 +1,234 @@ +<?php + +declare(strict_types = 1); + +namespace Drupal\Tests\oe_whitelabel_paragraphs\Kernel\Paragraphs; + +use Drupal\Core\Site\Settings; +use Drupal\file\Entity\File; +use Drupal\language\Entity\ConfigurableLanguage; +use Drupal\media\Entity\Media; +use Drupal\paragraphs\Entity\Paragraph; +use Drupal\Tests\oe_bootstrap_theme\PatternAssertion\FilePatternAssert; +use Drupal\Tests\user\Traits\UserCreationTrait; +use Drupal\user\Entity\User; +use Symfony\Component\DomCrawler\Crawler; + +/** + * Tests the document paragraph. + */ +class DocumentParagraphTest extends ParagraphsTestBase { + + use UserCreationTrait; + + /** + * {@inheritdoc} + */ + protected static $modules = [ + 'content_translation', + 'file_link_test', + 'language', + 'node', + 'oe_paragraphs_document', + ]; + + /** + * {@inheritdoc} + */ + protected function setUp(): void { + parent::setUp(); + + // The node dependency is wrongfully forced by oe_media_media_access(). + $this->installEntitySchema('node'); + $this->installEntitySchema('media'); + $this->installConfig([ + 'content_translation', + 'language', + 'media', + 'oe_media', + ]); + + $this->container->get('module_handler')->loadInclude('oe_paragraphs_media_field_storage', 'install'); + oe_paragraphs_media_field_storage_install(FALSE); + $this->installConfig(['oe_paragraphs_document']); + + ConfigurableLanguage::createFromLangcode('it')->save(); + ConfigurableLanguage::createFromLangcode('es')->save(); + + // Enable translations for the document media bundle. + $this->container->get('content_translation.manager')->setEnabled('media', 'document', TRUE); + // Make fields translatable. + $field_ids = [ + 'media.document.oe_media_file_type', + 'media.document.oe_media_remote_file', + 'media.document.oe_media_file', + ]; + foreach ($field_ids as $field_id) { + $field_config = $this->container->get('entity_type.manager')->getStorage('field_config')->load($field_id); + $field_config->set('translatable', TRUE)->save(); + } + $this->container->get('router.builder')->rebuild(); + + // Simulate the presence of test remote files. This avoids real requests to + // external websites. + $settings = Settings::getAll(); + $settings['file_link_test_middleware'] = [ + 'http://oe_whitelabel.drupal/spanish-document.txt' => [ + 'status' => 200, + 'headers' => [ + 'Content-Type' => 'text/plain', + 'Content-Length' => 45187, + ], + ], + 'http://oe_whitelabel.drupal/spreadsheet.xls' => [ + 'status' => 200, + 'headers' => [ + 'Content-Type' => 'application/vnd.ms-excel', + 'Content-Length' => 78459784, + ], + ], + ]; + new Settings($settings); + + // Tests need to run with user 1 as access checks prevent entity reference + // rendering otherwise. + $this->setCurrentUser(User::load(1)); + } + + /** + * Tests the file paragraph rendering. + */ + public function testRendering(): void { + $uri_en = $this->container->get('file_system')->copy( + $this->container->get('extension.list.module')->getPath('oe_media') . '/tests/fixtures/sample.pdf', + 'public://test.pdf' + ); + $pdf_en = File::create(['uri' => $uri_en]); + $pdf_en->save(); + + $local_media = Media::create([ + 'bundle' => 'document', + 'name' => 'Local PDF file', + 'oe_media_file_type' => 'local', + 'oe_media_file' => [ + 'target_id' => $pdf_en->id(), + ], + ]); + $local_media->save(); + + $paragraph = Paragraph::create([ + 'type' => 'oe_document', + 'field_oe_media' => [ + 'target_id' => $local_media->id(), + ], + ]); + $paragraph->save(); + + $html = $this->renderParagraph($paragraph); + $crawler = new Crawler($html); + $paragraph_wrapper = $crawler->filter('.paragraph'); + $this->assertCount(1, $paragraph_wrapper); + + $expected = [ + 'file' => [ + 'title' => 'Local PDF file', + 'language' => 'English', + 'url' => file_create_url($uri_en), + 'meta' => '(2.96 KB - PDF)', + 'icon' => 'file-pdf-fill', + ], + 'translations' => NULL, + 'link_label' => 'Download', + ]; + $assert = new FilePatternAssert(); + $assert->assertPattern($expected, $paragraph_wrapper->html()); + + // Add an Italian translation for the media. + $uri_it = $this->container->get('file_system')->copy( + $this->container->get('extension.list.module')->getPath('oe_media') . '/tests/fixtures/sample.pdf', + 'public://test_it.pdf' + ); + $pdf_it = File::create(['uri' => $uri_it]); + $pdf_it->save(); + $local_media->addTranslation('it', [ + 'name' => 'Italian translation', + 'oe_media_file_type' => 'local', + 'oe_media_file' => [ + 'target_id' => $pdf_it->id(), + ], + ]); + $local_media->save(); + + $html = $this->renderParagraph($paragraph); + $crawler = new Crawler($html); + $paragraph_wrapper = $crawler->filter('.paragraph'); + $this->assertCount(1, $paragraph_wrapper); + $expected['translations'] = [ + [ + 'title' => 'Italian translation', + 'language' => 'Italian', + 'url' => file_create_url($uri_it), + 'meta' => '(2.96 KB - PDF)', + ], + ]; + $assert->assertPattern($expected, $paragraph_wrapper->html()); + + // Add a Spanish translation that points to a remote file. + $local_media->addTranslation('es', [ + 'name' => 'Spanish translation', + 'oe_media_file_type' => 'remote', + 'oe_media_remote_file' => 'http://oe_whitelabel.drupal/spanish-document.txt', + ]); + $local_media->save(); + + $html = $this->renderParagraph($paragraph); + $crawler = new Crawler($html); + $paragraph_wrapper = $crawler->filter('.paragraph'); + $this->assertCount(1, $paragraph_wrapper); + $expected['translations'][] = [ + 'title' => 'Spanish translation', + 'language' => 'Spanish', + 'url' => 'http://oe_whitelabel.drupal/spanish-document.txt', + 'meta' => '(44.13 KB - TXT)', + ]; + $assert->assertPattern($expected, $paragraph_wrapper->html()); + + // Test a remote document as main file, to make sure that the + // DocumentMediaWrapper class is tested in all scenarios. + $remote_media = Media::create([ + 'bundle' => 'document', + 'name' => 'Remote XLS file', + 'oe_media_file_type' => 'remote', + 'oe_media_remote_file' => 'http://oe_whitelabel.drupal/spreadsheet.xls', + ]); + $remote_media->save(); + + $paragraph = Paragraph::create([ + 'type' => 'oe_document', + 'field_oe_media' => [ + 'target_id' => $remote_media->id(), + ], + ]); + $paragraph->save(); + + $html = $this->renderParagraph($paragraph); + $crawler = new Crawler($html); + $paragraph_wrapper = $crawler->filter('.paragraph'); + $this->assertCount(1, $paragraph_wrapper); + + $expected = [ + 'file' => [ + 'title' => 'Remote XLS file', + 'language' => 'English', + 'url' => 'http://oe_whitelabel.drupal/spreadsheet.xls', + 'meta' => '(74.83 MB - XLS)', + 'icon' => 'file-excel-fill', + ], + 'translations' => NULL, + 'link_label' => 'Download', + ]; + $assert = new FilePatternAssert(); + $assert->assertPattern($expected, $paragraph_wrapper->html()); + } + +} -- GitLab From bb0bc7a1694fd97fce3512ad39c20ae9c4ccc3ea Mon Sep 17 00:00:00 2001 From: Francesco Sardara <francesco@tdgwebservices.com> Date: Fri, 1 Apr 2022 20:59:44 +0200 Subject: [PATCH 7/8] OEL-494: The union languages helper class is now available in the parent theme. --- .../src/EuropeanUnionLanguages.php | 120 ------------------ .../src/TwigExtension/TwigExtension.php | 19 --- .../oe_whitelabel_multilingual.module | 2 +- oe_whitelabel.theme | 2 +- 4 files changed, 2 insertions(+), 141 deletions(-) delete mode 100644 modules/oe_whitelabel_helper/src/EuropeanUnionLanguages.php diff --git a/modules/oe_whitelabel_helper/src/EuropeanUnionLanguages.php b/modules/oe_whitelabel_helper/src/EuropeanUnionLanguages.php deleted file mode 100644 index 9ac60d58..00000000 --- a/modules/oe_whitelabel_helper/src/EuropeanUnionLanguages.php +++ /dev/null @@ -1,120 +0,0 @@ -<?php - -declare(strict_types = 1); - -namespace Drupal\oe_whitelabel_helper; - -/** - * Helper class storing European Union languages information. - * - * @see https://github.com/openeuropa/oe_theme/blob/HEAD/modules/oe_theme_helper/src/EuropeanUnionLanguages.php - */ -class EuropeanUnionLanguages { - - /** - * List of European Union languages. - * - * Each entry includes: - * - * - The language name in English - * - The language name in its native form - * - The internal language ID, used on URLs, asset names, etc. - * - * @var array - */ - protected static $languages = [ - 'bg' => ['Bulgarian', 'българÑки', 'bg'], - 'cs' => ['Czech', 'ÄeÅ¡tina', 'cs'], - 'da' => ['Danish', 'dansk', 'da'], - 'de' => ['German', 'Deutsch', 'de'], - 'et' => ['Estonian', 'eesti', 'et'], - 'el' => ['Greek', 'ελληνικά', 'el'], - 'en' => ['English', 'English', 'en'], - 'es' => ['Spanish', 'español', 'es'], - 'fr' => ['French', 'français', 'fr'], - 'ga' => ['Irish', 'Gaeilge', 'ga'], - 'hr' => ['Croatian', 'hrvatski', 'hr'], - 'it' => ['Italian', 'italiano', 'it'], - 'lt' => ['Lithuanian', 'lietuvių', 'lt'], - 'lv' => ['Latvian', 'latvieÅ¡u', 'lv'], - 'hu' => ['Hungarian', 'magyar', 'hu'], - 'mt' => ['Maltese', 'Malti', 'mt'], - 'nl' => ['Dutch', 'Nederlands', 'nl'], - 'pl' => ['Polish', 'polski', 'pl'], - 'pt-pt' => ['Portuguese', 'português', 'pt'], - 'ro' => ['Romanian', 'română', 'ro'], - 'sk' => ['Slovak', 'slovenÄina', 'sk'], - 'sl' => ['Slovenian', 'slovenÅ¡Äina', 'sl'], - 'fi' => ['Finnish', 'suomi', 'fi'], - 'sv' => ['Swedish', 'svenska', 'sv'], - ]; - - /** - * Returns a list of language data. - * - * This is the data that is expected to be returned by the overridden language - * manager as supplied by the OpenEuropa Multilingual module. - * - * @return array - * An array with language codes as keys, and English and native language - * names as values. - */ - public static function getLanguageList(): array { - return self::$languages; - } - - /** - * Assert whether the given language is a European Union one. - * - * @param string $language_code - * The language code as defined by the W3C language tags document. - * - * @return bool - * Whereas the given language is a European Union one. - */ - public static function hasLanguage(string $language_code): bool { - return isset(self::$languages[$language_code]); - } - - /** - * Get the language name in English given its W3C code. - * - * @param string $language_code - * The language code as defined by the W3C language tags document. - * - * @return string - * The language name in English if any, an empty string otherwise. - */ - public static function getEnglishLanguageName(string $language_code): string { - return self::$languages[$language_code][0] ?? ''; - } - - /** - * Get the native language name given its W3C code. - * - * @param string $language_code - * The language code as defined by the W3C language tags document. - * - * @return string - * The native language name if any, an empty string otherwise. - */ - public static function getNativeLanguageName(string $language_code): string { - return self::$languages[$language_code][1] ?? ''; - } - - /** - * Get the internal language code given its W3C code. - * - * Internal language codes may differ from the standard ones. - * - * @param string $language_code - * The language code as defined by the W3C language tags document. - * - * @return string - * The internal language code if any, an empty string otherwise. - */ - public static function getInternalLanguageCode(string $language_code): string { - return self::$languages[$language_code][2] ?? ''; - } - -} diff --git a/modules/oe_whitelabel_helper/src/TwigExtension/TwigExtension.php b/modules/oe_whitelabel_helper/src/TwigExtension/TwigExtension.php index 944b17e5..e6678251 100644 --- a/modules/oe_whitelabel_helper/src/TwigExtension/TwigExtension.php +++ b/modules/oe_whitelabel_helper/src/TwigExtension/TwigExtension.php @@ -6,7 +6,6 @@ namespace Drupal\oe_whitelabel_helper\TwigExtension; use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\StringTranslation\PluralTranslatableMarkup; -use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages; use Drupal\Core\Url; use Twig\Extension\AbstractExtension; use Twig\TwigFilter; @@ -37,7 +36,6 @@ class TwigExtension extends AbstractExtension { public function getFilters(): array { return [ new TwigFilter('bcl_timeago', [$this, 'bclTimeAgo']), - new TwigFilter('to_internal_language_id', [$this, 'toInternalLanguageId']), ]; } @@ -184,21 +182,4 @@ class TwigExtension extends AbstractExtension { return $block_plugin->build(); } - /** - * Get an internal language ID given its code. - * - * @param string $language_code - * The language code as defined by the W3C language tags document. - * - * @return string - * The internal language ID, or the given language code if none found. - */ - public function toInternalLanguageId(string $language_code): string { - if (EuropeanUnionLanguages::hasLanguage($language_code)) { - return EuropeanUnionLanguages::getInternalLanguageCode($language_code); - } - - return $language_code; - } - } diff --git a/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.module b/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.module index 1dc9264e..85fdf74f 100755 --- a/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.module +++ b/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.module @@ -8,7 +8,7 @@ declare(strict_types = 1); use Drupal\Component\Utility\Html; -use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages; +use Drupal\oe_bootstrap_theme_helper\EuropeanUnionLanguages; /** * Implements hook_preprocess_links(). diff --git a/oe_whitelabel.theme b/oe_whitelabel.theme index d6ecce13..6be05efd 100644 --- a/oe_whitelabel.theme +++ b/oe_whitelabel.theme @@ -9,8 +9,8 @@ declare(strict_types = 1); use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; +use Drupal\oe_bootstrap_theme_helper\EuropeanUnionLanguages; use Drupal\oe_whitelabel\DocumentMediaWrapper; -use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages; // Include all files from the includes directory. $includes_path = __DIR__ . '/includes/*.inc'; -- GitLab From d9f49b5dcbd436f42a28f15dee06bd5a1b9cd35a Mon Sep 17 00:00:00 2001 From: Francesco Sardara <francesco@tdgwebservices.com> Date: Wed, 6 Apr 2022 11:24:43 +0200 Subject: [PATCH 8/8] OEL-494: Update dependencies versions. --- composer.json | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index b730ebc1..5b83184f 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.1317.202203291220" + "openeuropa/oe_bootstrap_theme": "0.1.202204061107" }, "require-dev": { "composer/installers": "^1.11", @@ -82,11 +82,8 @@ } }, "patches": { - "openeuropa/oe_bootstrap_theme" : { - "OEL-494": "https://github.com/openeuropa/oe_bootstrap_theme/compare/0.1317.202203291220..OEL-494-v2.diff" - }, "openeuropa/oe_paragraphs": { - "OEL-494": "https://github.com/openeuropa/oe_paragraphs/compare/1.12.0..OEL-494.diff" + "latest": "https://github.com/openeuropa/oe_paragraphs/compare/1.12.0..master.diff" } }, "drupal-scaffold": { -- GitLab