From c095183550654d5005dd6505b45e78fb3047d30c Mon Sep 17 00:00:00 2001 From: Evgenii Nikitin Date: Wed, 8 Sep 2021 18:42:02 +0300 Subject: [PATCH] EWPP-1472: Fix output of image (avportal) inside news content type. --- ...ew_display.media.av_portal_photo.oe_theme_main_content.yml | 2 +- ...ew_display.media.av_portal_video.oe_theme_main_content.yml | 2 +- ...tity_view_display.media.document.oe_theme_main_content.yml | 2 +- ....entity_view_display.media.image.oe_theme_main_content.yml | 1 + ..._view_display.media.remote_video.oe_theme_main_content.yml | 2 +- .../Plugin/Field/FieldFormatter/MediaGalleryFormatterTest.php | 4 ++-- tests/Functional/ContentNewsRenderTest.php | 2 +- tests/Kernel/Paragraphs/MediaParagraphsTest.php | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/config/optional/core.entity_view_display.media.av_portal_photo.oe_theme_main_content.yml b/config/optional/core.entity_view_display.media.av_portal_photo.oe_theme_main_content.yml index 833b8f78ba..9f26a40232 100644 --- a/config/optional/core.entity_view_display.media.av_portal_photo.oe_theme_main_content.yml +++ b/config/optional/core.entity_view_display.media.av_portal_photo.oe_theme_main_content.yml @@ -7,7 +7,7 @@ dependencies: - media.type.av_portal_photo - responsive_image.styles.oe_theme_main_content module: - - media_avportal + - oe_media_avportal id: media.av_portal_photo.oe_theme_main_content targetEntityType: media bundle: av_portal_photo diff --git a/config/optional/core.entity_view_display.media.av_portal_video.oe_theme_main_content.yml b/config/optional/core.entity_view_display.media.av_portal_video.oe_theme_main_content.yml index 146a1a3e08..448234ec8f 100644 --- a/config/optional/core.entity_view_display.media.av_portal_video.oe_theme_main_content.yml +++ b/config/optional/core.entity_view_display.media.av_portal_video.oe_theme_main_content.yml @@ -6,7 +6,7 @@ dependencies: - field.field.media.av_portal_video.oe_media_avportal_video - media.type.av_portal_video module: - - media_avportal + - oe_media_avportal id: media.av_portal_video.oe_theme_main_content targetEntityType: media bundle: av_portal_video diff --git a/config/optional/core.entity_view_display.media.document.oe_theme_main_content.yml b/config/optional/core.entity_view_display.media.document.oe_theme_main_content.yml index 8269fb10a3..b4548336f5 100644 --- a/config/optional/core.entity_view_display.media.document.oe_theme_main_content.yml +++ b/config/optional/core.entity_view_display.media.document.oe_theme_main_content.yml @@ -6,7 +6,7 @@ dependencies: - field.field.media.document.oe_media_file - media.type.document module: - - file + - oe_media id: media.document.oe_theme_main_content targetEntityType: media bundle: document diff --git a/config/optional/core.entity_view_display.media.image.oe_theme_main_content.yml b/config/optional/core.entity_view_display.media.image.oe_theme_main_content.yml index 812d265e43..695f274b7c 100644 --- a/config/optional/core.entity_view_display.media.image.oe_theme_main_content.yml +++ b/config/optional/core.entity_view_display.media.image.oe_theme_main_content.yml @@ -7,6 +7,7 @@ dependencies: - media.type.image - responsive_image.styles.oe_theme_main_content module: + - oe_media - responsive_image id: media.image.oe_theme_main_content targetEntityType: media diff --git a/config/optional/core.entity_view_display.media.remote_video.oe_theme_main_content.yml b/config/optional/core.entity_view_display.media.remote_video.oe_theme_main_content.yml index 259b78f58e..1f6b32795e 100644 --- a/config/optional/core.entity_view_display.media.remote_video.oe_theme_main_content.yml +++ b/config/optional/core.entity_view_display.media.remote_video.oe_theme_main_content.yml @@ -6,7 +6,7 @@ dependencies: - field.field.media.remote_video.oe_media_oembed_video - media.type.remote_video module: - - media + - oe_media id: media.remote_video.oe_theme_main_content targetEntityType: media bundle: remote_video diff --git a/modules/oe_theme_helper/tests/src/Kernel/Plugin/Field/FieldFormatter/MediaGalleryFormatterTest.php b/modules/oe_theme_helper/tests/src/Kernel/Plugin/Field/FieldFormatter/MediaGalleryFormatterTest.php index e2d643291b..a00e2b7c10 100644 --- a/modules/oe_theme_helper/tests/src/Kernel/Plugin/Field/FieldFormatter/MediaGalleryFormatterTest.php +++ b/modules/oe_theme_helper/tests/src/Kernel/Plugin/Field/FieldFormatter/MediaGalleryFormatterTest.php @@ -215,7 +215,7 @@ public function testFormatter(): void { // Test the second gallery item. $this->assertStringStartsWith( - '/media/oembed?url=https%3A//www.youtube.com/watch%3Fv%3D1-g73ty9v04&max_width=0&max_height=0&hash=', + '/media/oembed?url=https%3A//www.youtube.com/watch%3Fv%3D1-g73ty9v04&max_width=576&max_height=400&hash=', $items->eq(1)->filter('.ecl-gallery__item-link')->attr('data-ecl-gallery-item-embed-src') ); $image_node = $items->eq(1)->filter('img'); @@ -311,7 +311,7 @@ public function testFormatter(): void { // Test the second gallery item. $this->assertStringStartsWith( - '/media/oembed?url=https%3A//www.youtube.com/watch%3Fv%3D1-g73ty9v04&max_width=0&max_height=0&hash=', + '/media/oembed?url=https%3A//www.youtube.com/watch%3Fv%3D1-g73ty9v04&max_width=576&max_height=400&hash=', $items->eq(1)->filter('.ecl-gallery__item-link')->attr('data-ecl-gallery-item-embed-src') ); $image_node = $items->eq(1)->filter('img'); diff --git a/tests/Functional/ContentNewsRenderTest.php b/tests/Functional/ContentNewsRenderTest.php index 6b92cdfdcf..72a02303ad 100644 --- a/tests/Functional/ContentNewsRenderTest.php +++ b/tests/Functional/ContentNewsRenderTest.php @@ -167,7 +167,7 @@ public function testNewsRendering(): void { $picture = $this->assertSession()->elementExists('css', 'article[role=article] article.ecl-u-type-paragraph.ecl-u-mb-l picture'); $image = $this->assertSession()->elementExists('css', 'img.ecl-u-width-100.ecl-u-height-auto', $picture); - $this->assertContains('placeholder_news_featured_media.png', $image->getAttribute('src')); + $this->assertContains('files/styles/oe_theme_medium_no_crop/public/placeholder_news_featured_media.png', $image->getAttribute('src')); $this->assertEquals('Alternative text news_featured_media', $image->getAttribute('alt')); // Unpublish the media and assert it is not rendered anymore. diff --git a/tests/Kernel/Paragraphs/MediaParagraphsTest.php b/tests/Kernel/Paragraphs/MediaParagraphsTest.php index 9cefbef640..06e0dacd06 100644 --- a/tests/Kernel/Paragraphs/MediaParagraphsTest.php +++ b/tests/Kernel/Paragraphs/MediaParagraphsTest.php @@ -244,7 +244,7 @@ public function testTextWithMedia(): void { 'title' => NULL, 'caption' => 'Caption', 'text' => NULL, - 'video' => '', + 'video' => '', 'video_ratio' => '16:9', ]; $assert->assertPattern($expected_values, $html);