From 655cb760fc79e4d2f80825d610b6af57e61f8e43 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Sun, 12 May 2024 07:55:50 +0100 Subject: [PATCH] Issue #3071446 by marcvangend, Kirst25, dcam, guptahemant, Lendude, nod_: Remove invalid iframe attributes from oembed field formatter --- core/modules/media/css/oembed.formatter.css | 2 ++ .../media/src/Plugin/Field/FieldFormatter/OEmbedFormatter.php | 3 --- .../src/Functional/FieldFormatter/OEmbedFormatterTest.php | 3 +++ core/themes/stable9/css/media/oembed.formatter.css | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/modules/media/css/oembed.formatter.css b/core/modules/media/css/oembed.formatter.css index caf220e444dd..d614238b96a1 100644 --- a/core/modules/media/css/oembed.formatter.css +++ b/core/modules/media/css/oembed.formatter.css @@ -1,3 +1,5 @@ .media-oembed-content { max-width: 100%; + border: none; + background-color: transparent; } diff --git a/core/modules/media/src/Plugin/Field/FieldFormatter/OEmbedFormatter.php b/core/modules/media/src/Plugin/Field/FieldFormatter/OEmbedFormatter.php index f682a0a8b9c0..70047c898316 100644 --- a/core/modules/media/src/Plugin/Field/FieldFormatter/OEmbedFormatter.php +++ b/core/modules/media/src/Plugin/Field/FieldFormatter/OEmbedFormatter.php @@ -22,7 +22,6 @@ use Drupal\media\Plugin\media\Source\OEmbedInterface; use Symfony\Component\DependencyInjection\ContainerInterface; -// cspell:ignore allowtransparency /** * Plugin implementation of the 'oembed' formatter. * @@ -227,9 +226,7 @@ public function viewElements(FieldItemListInterface $items, $langcode) { '#tag' => 'iframe', '#attributes' => [ 'src' => $url->toString(), - 'frameborder' => 0, 'scrolling' => FALSE, - 'allowtransparency' => TRUE, // External service is not supposed to send something larger // than the max width or max height, so those values should be used. 'width' => $resource->getWidth() ?: $max_width, diff --git a/core/modules/media/tests/src/Functional/FieldFormatter/OEmbedFormatterTest.php b/core/modules/media/tests/src/Functional/FieldFormatter/OEmbedFormatterTest.php index 8092385cec3e..c5426291dabf 100644 --- a/core/modules/media/tests/src/Functional/FieldFormatter/OEmbedFormatterTest.php +++ b/core/modules/media/tests/src/Functional/FieldFormatter/OEmbedFormatterTest.php @@ -72,6 +72,9 @@ public static function providerRender() { 'height' => '360', 'title' => 'Drupal Rap Video - Schipulcon09', 'loading' => 'lazy', + // cSpell:disable-next-line + 'allowtransparency' => NULL, + 'frameborder' => NULL, ], ], 'self_closing' => TRUE, diff --git a/core/themes/stable9/css/media/oembed.formatter.css b/core/themes/stable9/css/media/oembed.formatter.css index caf220e444dd..d614238b96a1 100644 --- a/core/themes/stable9/css/media/oembed.formatter.css +++ b/core/themes/stable9/css/media/oembed.formatter.css @@ -1,3 +1,5 @@ .media-oembed-content { max-width: 100%; + border: none; + background-color: transparent; } -- GitLab