[TASK] Add modestbranding to YouTubeRenderer 04/57304/2
authorGuido Schmechel <guido.schmechel@brandung.de>
Wed, 20 Jun 2018 15:59:33 +0000 (17:59 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Fri, 22 Jun 2018 18:38:47 +0000 (20:38 +0200)
Add the modestbranding parameter to the YoutubeRender.

Resolves: #85114
Releases: master, 8.7
Change-Id: Id76c0dd9ec764c820c2319c5dd57069e18c2cc71
Reviewed-on: https://review.typo3.org/57304
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/Resource/Rendering/YouTubeRenderer.php
typo3/sysext/core/Tests/Unit/Resource/Rendering/YouTubeRendererTest.php

index e06855d..b6ec3df 100644 (file)
@@ -114,6 +114,9 @@ class YouTubeRenderer implements FileRendererInterface
         if (!empty($options['autoplay'])) {
             $urlParams[] = 'autoplay=1';
         }
+        if (!empty($options['modestbranding'])) {
+            $urlParams[] = 'modestbranding=1';
+        }
         if (!empty($options['loop'])) {
             $urlParams[] = 'loop=1&amp;playlist=' . $videoId;
         }
index 502000e..f16d5f6 100644 (file)
@@ -257,4 +257,18 @@ class YouTubeRendererTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             $this->subject->render($fileResourceMock, '300m', '200', ['controls' => 0, 'no-cookie' => 0])
         );
     }
+
+    /**
+     * @test
+     */
+    public function renderOutputWithModestbrandingIsCorrect()
+    {
+        /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileResourceMock */
+        $fileResourceMock = $this->createMock(File::class);
+
+        $this->assertSame(
+            '<iframe src="https://www.youtube-nocookie.com/embed/7331?autohide=1&amp;controls=2&amp;modestbranding=1&amp;enablejsapi=1&amp;origin=http%3A%2F%2Ftest.server.org&amp;showinfo=0" allowfullscreen width="300" height="200"></iframe>',
+            $this->subject->render($fileResourceMock, '300m', '200', ['controls' => 2, 'modestbranding' => 1])
+        );
+    }
 }