diff --git a/config/schema/video_embed_field.schema.yml b/config/schema/video_embed_field.schema.yml index 8229b1e..52c4bdc 100644 --- a/config/schema/video_embed_field.schema.yml +++ b/config/schema/video_embed_field.schema.yml @@ -16,6 +16,21 @@ field.formatter.settings.video_embed_field_video: autoplay: type: boolean label: 'Autoplay' + autoplayadmin: + type: boolean + label: 'Autoplay for Admin' + loop: + type: boolean + label: 'Loop' + mute: + type: boolean + label: 'Mute' + controls: + type: boolean + label: 'Controls' + rel: + type: boolean + label: 'Related' responsive: type: boolean label: 'Responsive' @@ -33,6 +48,18 @@ field.formatter.settings.video_embed_hybrid: autoplay: type: boolean label: 'Autoplay' + loop: + type: boolean + label: 'Loop' + mute: + type: boolean + label: 'Mute' + controls: + type: boolean + label: 'Controls' + rel: + type: boolean + label: 'Related' responsive: type: boolean label: 'Responsive' diff --git a/modules/video_embed_wysiwyg/config/schema/video_embed_wysiwyg.schema.yml b/modules/video_embed_wysiwyg/config/schema/video_embed_wysiwyg.schema.yml index f571d64..3c2d6b0 100644 --- a/modules/video_embed_wysiwyg/config/schema/video_embed_wysiwyg.schema.yml +++ b/modules/video_embed_wysiwyg/config/schema/video_embed_wysiwyg.schema.yml @@ -13,6 +13,18 @@ ckeditor.plugin.video_embed: autoplay: label: 'Autoplay' type: boolean + loop: + label: 'Loop' + type: boolean + mute: + label: 'Mute' + type: boolean + controls: + label: 'Controls' + type: boolean + rel: + label: 'Related' + type: boolean responsive: label: 'Responsive' type: boolean diff --git a/modules/video_embed_wysiwyg/src/Plugin/Filter/VideoEmbedWysiwyg.php b/modules/video_embed_wysiwyg/src/Plugin/Filter/VideoEmbedWysiwyg.php index f0c50e7..8247308 100644 --- a/modules/video_embed_wysiwyg/src/Plugin/Filter/VideoEmbedWysiwyg.php +++ b/modules/video_embed_wysiwyg/src/Plugin/Filter/VideoEmbedWysiwyg.php @@ -88,7 +88,7 @@ class VideoEmbedWysiwyg extends FilterBase implements ContainerFactoryPluginInte } $autoplay = $this->currentUser->hasPermission('never autoplay videos') ? FALSE : $embed_data['settings']['autoplay']; - $embed_code = $provider->renderEmbedCode($embed_data['settings']['width'], $embed_data['settings']['height'], $autoplay); + $embed_code = $provider->renderEmbedCode($embed_data['settings']['width'], $embed_data['settings']['height'], $autoplay, $embed_data['settings']['loop'], $embed_data['settings']['mute'], $embed_data['settings']['controls'], $embed_data['settings']['rel']); $embed_code = [ '#type' => 'container', diff --git a/modules/video_embed_wysiwyg/tests/src/Functional/TextFormatConfigurationTest.php b/modules/video_embed_wysiwyg/tests/src/Functional/TextFormatConfigurationTest.php index 3f565f2..97298c3 100644 --- a/modules/video_embed_wysiwyg/tests/src/Functional/TextFormatConfigurationTest.php +++ b/modules/video_embed_wysiwyg/tests/src/Functional/TextFormatConfigurationTest.php @@ -143,6 +143,7 @@ class TextFormatConfigurationTest extends BrowserTestBase { // Assert all the form fields that appear on the modal, appear as // configurable defaults. $this->assertSession()->pageTextContains('Autoplay'); + $this->assertSession()->pageTextContains('Loop'); $this->assertSession()->pageTextContains('Responsive Video'); $this->assertSession()->pageTextContains('Width'); $this->assertSession()->pageTextContains('Height'); @@ -154,6 +155,7 @@ class TextFormatConfigurationTest extends BrowserTestBase { 'editor[settings][plugins][video_embed][defaults][children][height]' => '456', 'editor[settings][plugins][video_embed][defaults][children][responsive]' => FALSE, 'editor[settings][plugins][video_embed][defaults][children][autoplay]' => FALSE, + 'editor[settings][plugins][video_embed][defaults][children][loop]' => FALSE, ], t('Save configuration')); // Ensure the configured defaults show up on the modal window. @@ -161,6 +163,7 @@ class TextFormatConfigurationTest extends BrowserTestBase { $this->assertSession()->fieldValueEquals('width', '123'); $this->assertSession()->fieldValueEquals('height', '456'); $this->assertSession()->fieldValueEquals('autoplay', FALSE); + $this->assertSession()->fieldValueEquals('loop', FALSE); $this->assertSession()->fieldValueEquals('responsive', FALSE); } diff --git a/modules/video_embed_wysiwyg/tests/src/FunctionalJavascript/EmbedDialogTest.php b/modules/video_embed_wysiwyg/tests/src/FunctionalJavascript/EmbedDialogTest.php index c80d663..569433d 100644 --- a/modules/video_embed_wysiwyg/tests/src/FunctionalJavascript/EmbedDialogTest.php +++ b/modules/video_embed_wysiwyg/tests/src/FunctionalJavascript/EmbedDialogTest.php @@ -76,6 +76,7 @@ class EmbedDialogTest extends JavascriptTestBase { // Assert all the form fields appear on the modal. $this->assertSession()->pageTextContains('Autoplay'); + $this->assertSession()->pageTextContains('Loop'); $this->assertSession()->pageTextContains('Responsive Video'); $this->assertSession()->pageTextContains('Width'); $this->assertSession()->pageTextContains('Height'); @@ -101,7 +102,7 @@ class EmbedDialogTest extends JavascriptTestBase { // View the source of the ckeditor and find the output. $this->find('.cke_button__source_label')->click(); $base_path = \Drupal::request()->getBasePath(); - $this->assertEquals('

{"preview_thumbnail":"' . rtrim($base_path, '/') . '/' . $this->publicFilesDirectory . '/styles/video_embed_wysiwyg_preview/public/video_thumbnails/iaf3Sl2r3jE.jpg","video_url":"https://www.youtube.com/watch?v=iaf3Sl2r3jE&t=1553s","settings":{"responsive":1,"width":"854","height":"480","autoplay":1},"settings_summary":["Embedded Video (Responsive, autoplaying)."]}

', trim($this->getSession()->getPage()->find('css', '.cke_source')->getValue())); + $this->assertEquals('

{"preview_thumbnail":"' . rtrim($base_path, '/') . '/' . $this->publicFilesDirectory . '/styles/video_embed_wysiwyg_preview/public/video_thumbnails/iaf3Sl2r3jE.jpg","video_url":"https://www.youtube.com/watch?v=iaf3Sl2r3jE&t=1553s","settings":{"responsive":1,"width":"854","height":"480","autoplay":1,"playlist":"iaf3Sl2r3jE"},"settings_summary":["Embedded Video (Responsive, autoplaying, looping)."]}

', trim($this->getSession()->getPage()->find('css', '.cke_source')->getValue())); } /** @@ -109,7 +110,7 @@ class EmbedDialogTest extends JavascriptTestBase { */ public function testNestedMarkup() { $nested_content = '
-

{"preview_thumbnail":"/thumb.jpg","video_url":"https://www.youtube.com/watch?v=iaf3Sl2r3jE","settings":{"responsive":1,"width":"854","height":"480","autoplay":1},"settings_summary":["Embedded Video (Responsive, autoplaying)."]}

+

{"preview_thumbnail":"/thumb.jpg","video_url":"https://www.youtube.com/watch?v=iaf3Sl2r3jE","settings":{"responsive":1,"width":"854","height":"480","autoplay":1,"playlist":"iaf3Sl2r3jE"},"settings_summary":["Embedded Video (Responsive, autoplaying, looping)."]}

'; $node = $this->createNode([ 'type' => 'page', diff --git a/src/Plugin/Field/FieldFormatter/Video.php b/src/Plugin/Field/FieldFormatter/Video.php index 361207a..1216f76 100644 --- a/src/Plugin/Field/FieldFormatter/Video.php +++ b/src/Plugin/Field/FieldFormatter/Video.php @@ -98,7 +98,10 @@ class Video extends FormatterBase implements ContainerFactoryPluginInterface { } else { $autoplay = $this->currentUser->hasPermission('never autoplay videos') ? FALSE : $this->getSetting('autoplay'); - $element[$delta] = $provider->renderEmbedCode($this->getSetting('width'), $this->getSetting('height'), $autoplay); + if (\Drupal\user\Entity\User::load(\Drupal::currentUser()->id())->hasRole('administrator') && $autoplay = $this->getSetting('autoplayadmin')) { + $autoplay = TRUE; + } + $element[$delta] = $provider->renderEmbedCode($this->getSetting('width'), $this->getSetting('height'), $autoplay, $this->getSetting('loop'), $this->getSetting('mute'), $this->getSetting('controls'), $this->getSetting('rel')); $element[$delta]['#cache']['contexts'][] = 'user.permissions'; $element[$delta] = [ @@ -126,7 +129,12 @@ class Video extends FormatterBase implements ContainerFactoryPluginInterface { 'responsive' => TRUE, 'width' => '854', 'height' => '480', - 'autoplay' => TRUE, + 'autoplay' => FALSE, + 'autoplayadmin' => FALSE, + 'loop' => FALSE, + 'mute' => FALSE, + 'controls' => TRUE, + 'rel' => FALSE, ]; } @@ -141,6 +149,36 @@ class Video extends FormatterBase implements ContainerFactoryPluginInterface { '#description' => $this->t('Autoplay the videos for users without the "never autoplay videos" permission. Roles with this permission will bypass this setting.'), '#default_value' => $this->getSetting('autoplay'), ]; + $elements['autoplayadmin'] = [ + '#title' => $this->t('Autoplay for Admin'), + '#type' => 'checkbox', + '#description' => $this->t('Autoplay the videos for users with the administrator role.'), + '#default_value' => $this->getSetting('autoplayadmin'), + ]; + $elements['loop'] = [ + '#title' => $this->t('Loop'), + '#type' => 'checkbox', + '#description' => $this->t('Loop the video.'), + '#default_value' => $this->getSetting('loop'), + ]; + $elements['mute'] = [ + '#title' => $this->t('Mute'), + '#type' => 'checkbox', + '#description' => $this->t('Mute the video.'), + '#default_value' => $this->getSetting('mute'), + ]; + $elements['controls'] = [ + '#title' => $this->t('Controls'), + '#type' => 'checkbox', + '#description' => $this->t('Show controls.'), + '#default_value' => $this->getSetting('controls'), + ]; + $elements['rel'] = [ + '#title' => $this->t('Related'), + '#type' => 'checkbox', + '#description' => $this->t('Show related videos.'), + '#default_value' => $this->getSetting('rel'), + ]; $elements['responsive'] = [ '#title' => $this->t('Responsive Video'), '#type' => 'checkbox', @@ -182,9 +220,14 @@ class Video extends FormatterBase implements ContainerFactoryPluginInterface { */ public function settingsSummary() { $dimensions = $this->getSetting('responsive') ? $this->t('Responsive') : $this->t('@widthx@height', ['@width' => $this->getSetting('width'), '@height' => $this->getSetting('height')]); - $summary[] = $this->t('Embedded Video (@dimensions@autoplay).', [ + $summary[] = $this->t('Embedded Video (@dimensions@autoplay@autoplayadmin@loop@mute@controls@rel).', [ '@dimensions' => $dimensions, '@autoplay' => $this->getSetting('autoplay') ? $this->t(', autoplaying') : '', + '@autoplayadmin' => $this->getSetting('autoplayadmin') ? $this->t(', autoplaying for admin') : '', + '@loop' => $this->getSetting('loop') ? $this->t(', looping') : '', + '@mute' => $this->getSetting('mute') ? $this->t(', mute') : '', + '@controls' => $this->getSetting('controls') ? $this->t(', show controls') : ', hide controls', + '@rel' => $this->getSetting('rel') ? $this->t(', show related videos') : ', hide related videos', ]); return $summary; } diff --git a/src/Plugin/video_embed_field/Provider/Vimeo.php b/src/Plugin/video_embed_field/Provider/Vimeo.php index 70c7f6b..a5753f0 100644 --- a/src/Plugin/video_embed_field/Provider/Vimeo.php +++ b/src/Plugin/video_embed_field/Provider/Vimeo.php @@ -17,13 +17,15 @@ class Vimeo extends ProviderPluginBase { /** * {@inheritdoc} */ - public function renderEmbedCode($width, $height, $autoplay) { + public function renderEmbedCode($width, $height, $autoplay, $loop, $mute, $controls, $rel) { $iframe = [ '#type' => 'video_embed_iframe', '#provider' => 'vimeo', '#url' => sprintf('https://player.vimeo.com/video/%s', $this->getVideoId()), '#query' => [ 'autoplay' => $autoplay, + 'loop' => $loop, + 'muted' => $mute, ], '#attributes' => [ 'width' => $width, diff --git a/src/Plugin/video_embed_field/Provider/YouTube.php b/src/Plugin/video_embed_field/Provider/YouTube.php index aa11aea..ffc0a43 100644 --- a/src/Plugin/video_embed_field/Provider/YouTube.php +++ b/src/Plugin/video_embed_field/Provider/YouTube.php @@ -17,7 +17,7 @@ class YouTube extends ProviderPluginBase { /** * {@inheritdoc} */ - public function renderEmbedCode($width, $height, $autoplay) { + public function renderEmbedCode($width, $height, $autoplay, $loop, $mute, $controls, $rel) { $embed_code = [ '#type' => 'video_embed_iframe', '#provider' => 'youtube', @@ -25,7 +25,10 @@ class YouTube extends ProviderPluginBase { '#query' => [ 'autoplay' => $autoplay, 'start' => $this->getTimeIndex(), - 'rel' => '0', + 'loop' => $loop, + 'mute' => $mute, + 'controls' => $controls, + 'rel' => $rel, ], '#attributes' => [ 'width' => $width, @@ -37,6 +40,9 @@ class YouTube extends ProviderPluginBase { if ($language = $this->getLanguagePreference()) { $embed_code['#query']['cc_lang_pref'] = $language; } + if ($loop) { + $embed_code['#query']['playlist'] = $this->getVideoId(); + } return $embed_code; } diff --git a/src/Plugin/video_embed_field/Provider/YouTubePlaylist.php b/src/Plugin/video_embed_field/Provider/YouTubePlaylist.php index 1043c5a..2f3bef9 100644 --- a/src/Plugin/video_embed_field/Provider/YouTubePlaylist.php +++ b/src/Plugin/video_embed_field/Provider/YouTubePlaylist.php @@ -17,13 +17,16 @@ class YouTubePlaylist extends ProviderPluginBase { /** * {@inheritdoc} */ - public function renderEmbedCode($width, $height, $autoplay) { + public function renderEmbedCode($width, $height, $autoplay, $loop, $mute, $controls, $rel) { return [ '#type' => 'video_embed_iframe', '#provider' => 'youtube_playlist', '#url' => 'https://www.youtube.com/embed/videoseries', '#query' => [ 'list' => $this->getVideoId(), + 'mute' => $mute, + 'controls' => $controls, + 'rel' => $rel, ], '#attributes' => [ 'width' => $width, diff --git a/src/ProviderPluginInterface.php b/src/ProviderPluginInterface.php index 863feeb..81c5d17 100644 --- a/src/ProviderPluginInterface.php +++ b/src/ProviderPluginInterface.php @@ -72,11 +72,19 @@ interface ProviderPluginInterface extends PluginInspectionInterface { * The height of the video player. * @param bool $autoplay * If the video should autoplay. + * @param bool $loop + * If the video should loop. + * @param bool $mute + * If the video should play muted. + * @param bool $controls + * Whether show controls (youtube only). + * @param bool $rel + * Whether show related videos (youtube only). * * @return mixed * A renderable array of the embed code. */ - public function renderEmbedCode($width, $height, $autoplay); + public function renderEmbedCode($width, $height, $autoplay, $loop, $mute, $controls, $rel); /** * Get the ID of the video from user input. diff --git a/tests/modules/video_embed_field_mock_provider/src/Plugin/video_embed_field/Provider/MockProvider.php b/tests/modules/video_embed_field_mock_provider/src/Plugin/video_embed_field/Provider/MockProvider.php index da282f7..a80fbe8 100644 --- a/tests/modules/video_embed_field_mock_provider/src/Plugin/video_embed_field/Provider/MockProvider.php +++ b/tests/modules/video_embed_field_mock_provider/src/Plugin/video_embed_field/Provider/MockProvider.php @@ -33,7 +33,7 @@ class MockProvider implements ProviderPluginInterface { /** * {@inheritdoc} */ - public function renderEmbedCode($width, $height, $autoplay) { + public function renderEmbedCode($width, $height, $autoplay, $loop) { return [ '#markup' => 'Mock provider embed code.', ]; diff --git a/tests/src/Functional/FormatterConfigurationTest.php b/tests/src/Functional/FormatterConfigurationTest.php index 985c005..eaa4a07 100644 --- a/tests/src/Functional/FormatterConfigurationTest.php +++ b/tests/src/Functional/FormatterConfigurationTest.php @@ -48,11 +48,13 @@ class FormatterConfigurationTest extends BrowserTestBase { public function testVideoConfirmationForm() { // Test the settings form and summaries for the video formatter. $this->setFormatter('video_embed_field_video'); - $this->assertSession()->pageTextContains('Embedded Video (Responsive, autoplaying).'); + $this->assertSession()->pageTextContains('Embedded Video (Responsive, autoplaying, looping).'); $this->updateFormatterSettings([ 'autoplay' => FALSE, + 'loop' => FALSE, 'responsive' => FALSE, 'width' => 100, + 'width' => 100, 'height' => 100, ]); $this->assertSession()->pageTextContains('Embedded Video (100x100).'); @@ -73,10 +75,11 @@ class FormatterConfigurationTest extends BrowserTestBase { $this->setFormatter('video_embed_field_colorbox'); $this->assertSession()->pageTextContains('Thumbnail that launches a modal window.'); - $this->assertSession()->pageTextContains('Embedded Video (Responsive, autoplaying).'); + $this->assertSession()->pageTextContains('Embedded Video (Responsive, autoplaying, looping).'); $this->assertSession()->pageTextContains('Video thumbnail (medium, linked to provider).'); $this->updateFormatterSettings([ 'autoplay' => FALSE, + 'loop' => FALSE, 'responsive' => FALSE, 'width' => 100, 'height' => 100, diff --git a/tests/src/FunctionalJavascript/ColorboxFormatterTest.php b/tests/src/FunctionalJavascript/ColorboxFormatterTest.php index 685b1a1..dcab368 100644 --- a/tests/src/FunctionalJavascript/ColorboxFormatterTest.php +++ b/tests/src/FunctionalJavascript/ColorboxFormatterTest.php @@ -44,6 +44,7 @@ class ColorboxFormatterTest extends JavascriptTestBase { public function testColorboxFormatter() { $this->setDisplayComponentSettings('video_embed_field_colorbox', [ 'autoplay' => FALSE, + 'loop' => FALSE, 'responsive' => TRUE, ]); $node = $this->createVideoNode('https://example.com/mock_video'); diff --git a/tests/src/FunctionalJavascript/LazyLoadFormatterTest.php b/tests/src/FunctionalJavascript/LazyLoadFormatterTest.php index b7bc673..5ba71cb 100644 --- a/tests/src/FunctionalJavascript/LazyLoadFormatterTest.php +++ b/tests/src/FunctionalJavascript/LazyLoadFormatterTest.php @@ -37,6 +37,7 @@ class LazyLoadFormatterTest extends JavascriptTestBase { public function testColorboxFormatter() { $this->setDisplayComponentSettings('video_embed_field_lazyload', [ 'autoplay' => TRUE, + 'loop' => TRUE, 'responsive' => TRUE, ]); $node = $this->createVideoNode('https://example.com/mock_video'); diff --git a/tests/src/Kernel/FieldOutputTest.php b/tests/src/Kernel/FieldOutputTest.php index 5ce00a5..60b8155 100644 --- a/tests/src/Kernel/FieldOutputTest.php +++ b/tests/src/Kernel/FieldOutputTest.php @@ -54,6 +54,7 @@ class FieldOutputTest extends KernelTestBase { 'width' => 100, 'height' => 100, 'autoplay' => TRUE, + 'loop' => TRUE, 'responsive' => FALSE, ], ], @@ -70,6 +71,7 @@ class FieldOutputTest extends KernelTestBase { '#url' => 'https://www.youtube.com/embed/fdbFVWupSsw', '#query' => [ 'autoplay' => '1', + 'loop' => '1', 'start' => '0', 'rel' => '0', ], @@ -95,6 +97,7 @@ class FieldOutputTest extends KernelTestBase { 'width' => 100, 'height' => 100, 'autoplay' => TRUE, + 'loop' => TRUE, 'responsive' => FALSE, ], ], @@ -111,6 +114,7 @@ class FieldOutputTest extends KernelTestBase { '#url' => 'https://www.youtube.com/embed/fdbFVWupSsw', '#query' => [ 'autoplay' => '1', + 'loop' => '1', 'start' => '100', 'rel' => '0', ], @@ -136,6 +140,7 @@ class FieldOutputTest extends KernelTestBase { 'width' => 100, 'height' => 100, 'autoplay' => TRUE, + 'loop' => TRUE, 'responsive' => FALSE, ], ], @@ -152,6 +157,7 @@ class FieldOutputTest extends KernelTestBase { '#url' => 'https://www.youtube.com/embed/fdbFVWupSsw', '#query' => [ 'autoplay' => '1', + 'loop' => '1', 'start' => '0', 'rel' => '0', 'cc_lang_pref' => 'fr', @@ -189,6 +195,7 @@ class FieldOutputTest extends KernelTestBase { 'width' => 100, 'height' => 100, 'autoplay' => TRUE, + 'loop' => TRUE, 'responsive' => FALSE, ], ], @@ -205,6 +212,7 @@ class FieldOutputTest extends KernelTestBase { '#url' => 'https://player.vimeo.com/video/80896303', '#query' => [ 'autoplay' => '1', + 'loop' => '1', ], '#attributes' => [ 'width' => '100', @@ -228,6 +236,7 @@ class FieldOutputTest extends KernelTestBase { 'width' => 100, 'height' => 100, 'autoplay' => TRUE, + 'loop' => TRUE, 'responsive' => FALSE, ], ], @@ -244,6 +253,7 @@ class FieldOutputTest extends KernelTestBase { '#url' => 'https://player.vimeo.com/video/80896303', '#query' => [ 'autoplay' => '1', + 'loop' => '1', ], '#fragment' => 't=150s', '#attributes' => [ @@ -297,6 +307,7 @@ class FieldOutputTest extends KernelTestBase { 'settings' => [ 'link_image_to' => Thumbnail::LINK_PROVIDER, 'autoplay' => TRUE, + 'loop' => TRUE, 'width' => 500, 'height' => 500, 'responsive' => FALSE, @@ -305,7 +316,7 @@ class FieldOutputTest extends KernelTestBase { [ '#type' => 'container', '#attributes' => [ - 'data-video-embed-field-modal' => '
', + 'data-video-embed-field-modal' => '
', 'class' => ['video-embed-field-launch-modal'], ], '#attached' => [ @@ -336,6 +347,7 @@ class FieldOutputTest extends KernelTestBase { 'settings' => [ 'link_image_to' => Thumbnail::LINK_PROVIDER, 'autoplay' => TRUE, + 'loop' => TRUE, 'width' => 900, 'height' => 450, 'responsive' => TRUE, @@ -345,7 +357,7 @@ class FieldOutputTest extends KernelTestBase { [ '#type' => 'container', '#attributes' => [ - 'data-video-embed-field-modal' => '
', + 'data-video-embed-field-modal' => '
', 'class' => [ 'video-embed-field-launch-modal', ], @@ -378,6 +390,7 @@ class FieldOutputTest extends KernelTestBase { 'settings' => [ 'link_image_to' => Thumbnail::LINK_PROVIDER, 'autoplay' => TRUE, + 'loop' => TRUE, 'width' => 900, 'height' => 450, 'responsive' => TRUE, @@ -387,7 +400,7 @@ class FieldOutputTest extends KernelTestBase { [ '#type' => 'container', '#attributes' => [ - 'data-video-embed-field-lazy' => '
', + 'data-video-embed-field-lazy' => '
', 'class' => [ 'video-embed-field-lazy', ], @@ -431,6 +444,7 @@ class FieldOutputTest extends KernelTestBase { 'width' => 100, 'height' => 100, 'autoplay' => TRUE, + 'loop' => TRUE, 'responsive' => TRUE, ], ], @@ -451,6 +465,7 @@ class FieldOutputTest extends KernelTestBase { '#url' => 'https://player.vimeo.com/video/80896303', '#query' => [ 'autoplay' => '1', + 'loop' => '1', ], '#attributes' => [ 'width' => '100', @@ -474,6 +489,7 @@ class FieldOutputTest extends KernelTestBase { 'width' => 100, 'height' => 100, 'autoplay' => TRUE, + 'loop' => TRUE, 'responsive' => FALSE, ], ], diff --git a/tests/src/Kernel/VideoEmbedIFrameTest.php b/tests/src/Kernel/VideoEmbedIFrameTest.php index 8a28d50..f2d068e 100644 --- a/tests/src/Kernel/VideoEmbedIFrameTest.php +++ b/tests/src/Kernel/VideoEmbedIFrameTest.php @@ -34,20 +34,20 @@ class VideoEmbedIFrameTest extends KernelTestBase { [ '#type' => 'video_embed_iframe', '#url' => 'https://www.youtube.com/embed/fdbFVWupSsw', - '#query' => ['autoplay' => '1'], + '#query' => ['autoplay' => '1', 'playlist' => 'fdbFVWupSsw'], ], - '', + '', ], 'URL, query, attributes' => [ [ '#type' => 'video_embed_iframe', '#url' => 'https://www.youtube.com/embed/fdbFVWupSsw', - '#query' => ['autoplay' => '1'], + '#query' => ['autoplay' => '1', 'playlist' => 'fdbFVWupSsw'], '#attributes' => [ 'width' => '100', ], ], - '', + '', ], 'Query' => [ [ diff --git a/tests/src/Unit/ProviderUrlParseTest.php b/tests/src/Unit/ProviderUrlParseTest.php index 5790806..3d09728 100644 --- a/tests/src/Unit/ProviderUrlParseTest.php +++ b/tests/src/Unit/ProviderUrlParseTest.php @@ -199,7 +199,7 @@ class ProviderUrlParseTest extends UnitTestCase { $provider = new YouTube([ 'input' => $url, ], '', [], new MockHttpClient()); - $embed = $provider->renderEmbedCode(100, 100, TRUE); + $embed = $provider->renderEmbedCode(100, 100, TRUE, TRUE); $language = isset($embed['#query']['cc_lang_pref']) ? $embed['#query']['cc_lang_pref'] : FALSE; $this->assertEquals($expected, $language); } @@ -240,7 +240,7 @@ class ProviderUrlParseTest extends UnitTestCase { $provider = new YouTube([ 'input' => $url, ], '', [], new MockHttpClient()); - $embed = $provider->renderEmbedCode(100, 100, TRUE); + $embed = $provider->renderEmbedCode(100, 100, TRUE, TRUE); $this->assertEquals($expected, $embed['#query']['start']); } @@ -286,7 +286,7 @@ class ProviderUrlParseTest extends UnitTestCase { $this->assertEquals($exception_expected, $exception_triggered); if (!$exception_triggered) { - $embed = $provider->renderEmbedCode(100, 100, TRUE); + $embed = $provider->renderEmbedCode(100, 100, TRUE, TRUE); $this->assertEquals($expected, isset($embed['#fragment']) ? $embed['#fragment'] : FALSE); } }