diff --git a/typo3/sysext/core/Classes/Resource/Rendering/VideoTagRenderer.php b/typo3/sysext/core/Classes/Resource/Rendering/VideoTagRenderer.php index d779493af0fabf4c2e08ef4cc2536b63d3b33c3a..3408234b23cd74e167afb00a30b623756b2267c4 100644 --- a/typo3/sysext/core/Classes/Resource/Rendering/VideoTagRenderer.php +++ b/typo3/sysext/core/Classes/Resource/Rendering/VideoTagRenderer.php @@ -104,12 +104,23 @@ class VideoTagRenderer implements FileRendererInterface if (!empty($options['loop'])) { $attributes[] = 'loop'; } + if (is_array($options['additionalConfig'])) { + foreach ($options['additionalConfig'] as $key => $value) { + if ((bool)$value) { + $attributes[] = htmlspecialchars($key); + } + } + } + foreach (['class', 'dir', 'id', 'lang', 'style', 'title', 'accesskey', 'tabindex', 'onclick', 'controlsList'] as $key) { if (!empty($options[$key])) { $attributes[] = $key . '="' . htmlspecialchars($options[$key]) . '"'; } } + // Clean up duplicate attributes + $attributes = array_unique($attributes); + return sprintf( '<video%s><source src="%s" type="%s"></video>', empty($attributes) ? '' : ' ' . implode(' ', $attributes), diff --git a/typo3/sysext/core/Tests/Unit/Resource/Rendering/VideoTagRendererTest.php b/typo3/sysext/core/Tests/Unit/Resource/Rendering/VideoTagRendererTest.php index 306a383f14dc1c84f002e7be68ed292dd57d7653..40bfeee0ba7882c329cdbf8a50f56239a4ac06e8 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/Rendering/VideoTagRendererTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/Rendering/VideoTagRendererTest.php @@ -104,6 +104,24 @@ class VideoTagRendererTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas '//:path/myVideoFile', ['data' => ['js-required' => 'yes', 'custom-id' => 'video-123']], '<video data-js-required="yes" data-custom-id="video-123" width="300" height="200" controls><source src="//:path/myVideoFile" type="video/mp4"></video>', + ], + [ + '//:path/myVideoFile', + [ + 'data' => [ + 'js-required' => 'yes', + 'custom-id' => 'video-123' + ], + 'additionalAttributes' => [ + 'muted' => 'muted', + 'foo' => 'bar' + ], + 'additionalConfig' => [ + 'playsinline' => '1', + 'controls' => '1' + ] + ], + '<video muted="muted" foo="bar" data-js-required="yes" data-custom-id="video-123" width="300" height="200" controls playsinline><source src="//:path/myVideoFile" type="video/mp4"></video>', ] ]; }