From 54fd8371c5639c87249fa79cdee0e69608882d2c Mon Sep 17 00:00:00 2001 From: nagyad Date: Mon, 30 Jan 2023 14:51:12 +0100 Subject: [PATCH 1/2] EWPP-3048: Do not apply custom ratio class on iframes. --- oe_theme.theme | 3 +-- ...--oe-media-iframe--iframe--oe-theme-main-content.html.twig | 1 - templates/paragraphs/paragraph--oe-iframe-media.html.twig | 4 ---- tests/src/Kernel/MediaRenderTest.php | 2 +- tests/src/Kernel/Paragraphs/MediaParagraphsTest.php | 4 ++-- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/oe_theme.theme b/oe_theme.theme index e6500d22b..f5f013dc1 100644 --- a/oe_theme.theme +++ b/oe_theme.theme @@ -1668,8 +1668,7 @@ function oe_theme_preprocess_field__media__oe_media_iframe__video_iframe__oe_the * Prepared ratio to be used in templates. */ function _oe_theme_get_oe_media_iframe_ratio(MediaInterface $media): string { - $ratio = $media->get('oe_media_iframe_ratio')->value ?? 'custom'; - return str_replace('_', '-', $ratio); + return $media->get('oe_media_iframe_ratio')->isEmpty() ? '' : str_replace('_', '-', $media->get('oe_media_iframe_ratio')->value); } /** diff --git a/templates/field/field--media--oe-media-iframe--iframe--oe-theme-main-content.html.twig b/templates/field/field--media--oe-media-iframe--iframe--oe-theme-main-content.html.twig index 6a94ddee8..521dd9012 100644 --- a/templates/field/field--media--oe-media-iframe--iframe--oe-theme-main-content.html.twig +++ b/templates/field/field--media--oe-media-iframe--iframe--oe-theme-main-content.html.twig @@ -8,6 +8,5 @@ {% include '@ecl-twig/media-container' with { 'embedded_media': item.content, 'ratio': ratio, - 'extra_classes': (ratio == 'custom') ? 'ecl-media-container--custom-ratio' : '', } %} {% endfor %} diff --git a/templates/paragraphs/paragraph--oe-iframe-media.html.twig b/templates/paragraphs/paragraph--oe-iframe-media.html.twig index 0c2f2bff3..9c5f3e596 100644 --- a/templates/paragraphs/paragraph--oe-iframe-media.html.twig +++ b/templates/paragraphs/paragraph--oe-iframe-media.html.twig @@ -13,10 +13,6 @@ {% set extra_classes = ['ecl-media-container--fullwidth'] %} {% endif %} -{% if ratio == 'custom' %} - {% set extra_classes = extra_classes|merge(['ecl-media-container--custom-ratio']) %} -{% endif %} - {% if not paragraph.field_oe_title.isEmpty() %}

{{ content.field_oe_title }}

{% endif %} diff --git a/tests/src/Kernel/MediaRenderTest.php b/tests/src/Kernel/MediaRenderTest.php index ac2dd13fa..5b95e4f1f 100644 --- a/tests/src/Kernel/MediaRenderTest.php +++ b/tests/src/Kernel/MediaRenderTest.php @@ -330,7 +330,7 @@ public function testIframeMedia(): void { $build = $this->mediaViewBuilder->view($media, 'oe_theme_main_content'); $html = $this->renderRoot($build); $crawler = new Crawler($html); - $iframe = $crawler->filter('.ecl-media-container .ecl-media-container__media--ratio-custom iframe'); + $iframe = $crawler->filter('.ecl-media-container iframe'); $this->assertEquals('http://example.com/iframe_media', $iframe->attr('src')); // Assert iframe media with aspect ratio 3:2. diff --git a/tests/src/Kernel/Paragraphs/MediaParagraphsTest.php b/tests/src/Kernel/Paragraphs/MediaParagraphsTest.php index be33b56d6..45174f0e9 100644 --- a/tests/src/Kernel/Paragraphs/MediaParagraphsTest.php +++ b/tests/src/Kernel/Paragraphs/MediaParagraphsTest.php @@ -891,7 +891,7 @@ public function testIframe(): void { $this->container->get('entity_type.manager')->getAccessControlHandler('media')->resetCache(); $html = $this->renderParagraph($paragraph); $crawler = new Crawler($html); - $iframe = $crawler->filter('figure.ecl-media-container.ecl-media-container--custom-ratio div.ecl-media-container__media.ecl-media-container__media--ratio-custom iframe'); + $iframe = $crawler->filter('figure.ecl-media-container div.ecl-media-container__media iframe'); $this->assertStringContainsString('http://example.com/iframe', $iframe->attr('src')); $this->assertStringNotContainsString('ecl-u-type-heading-2', $html); @@ -899,7 +899,7 @@ public function testIframe(): void { $paragraph->set('field_oe_iframe_media_full_width', TRUE)->save(); $html = $this->renderParagraph($paragraph); $crawler = new Crawler($html); - $iframe = $crawler->filter('figure.ecl-media-container.ecl-media-container--fullwidth.ecl-media-container--custom-ratio div.ecl-media-container__media.ecl-media-container__media--ratio-custom iframe'); + $iframe = $crawler->filter('figure.ecl-media-container.ecl-media-container--fullwidth div.ecl-media-container__media iframe'); $this->assertStringContainsString('http://example.com/iframe', $iframe->attr('src')); // Assert ratio. From e0981fc915d6f367b9ed98c2c30223b4a4650103 Mon Sep 17 00:00:00 2001 From: nagyad Date: Mon, 30 Jan 2023 15:02:46 +0100 Subject: [PATCH 2/2] EWPP-3048: Lock grunt and grunt-contrib-copy. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index abad941db..3003e0623 100644 --- a/package.json +++ b/package.json @@ -64,8 +64,8 @@ "@ecl/vanilla-utility-background": "3.6.0", "@ecl/vanilla-utility-border": "3.6.0", "chokidar-cli": "1.2.0", - "grunt": "^1.4.0", - "grunt-contrib-copy": "^1.0.0", + "grunt": "1.4.0", + "grunt-contrib-copy": "1.0.0", "moment": "2.29.1", "node-sass": "4.13.1", "npm-run-all": "4.0.2",