From c3de718eb71fa0d0c0418dbaeae0eeb4ed37970e Mon Sep 17 00:00:00 2001 From: antograssiot Date: Sun, 13 Sep 2015 17:37:19 +0200 Subject: [PATCH 1/2] add the `showinfo` option for youtube --- src/View/Helper/VideoHelper.php | 5 +++-- tests/TestCase/View/Helper/VideoHelperTest.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/View/Helper/VideoHelper.php b/src/View/Helper/VideoHelper.php index 511d51d..6493142 100644 --- a/src/View/Helper/VideoHelper.php +++ b/src/View/Helper/VideoHelper.php @@ -82,7 +82,8 @@ public function youtube($url, $settings = array()) 'allowfullscreen' => true, 'frameborder' => 0, 'related' => false, - 'autoplay' => false + 'autoplay' => false, + 'showinfo' => true, ); $settings = array_merge($defaultSettings, $settings); @@ -92,7 +93,7 @@ public function youtube($url, $settings = array()) return $this->_notFound(!empty($settings['failSilently'])); } - $settings['src'] = $this->_apis['youtube'] . '/embed/' . $videoId . '?hd=' . (int)$settings['hd'] . '&rel=' . (int)$settings['related'] . '&autoplay=' . (int)$settings['autoplay']; + $settings['src'] = $this->_apis['youtube'] . '/embed/' . $videoId . '?hd=' . (int)$settings['hd'] . '&rel=' . (int)$settings['related'] . '&autoplay=' . (int)$settings['autoplay'] . '&showinfo=' . (int)$settings['showinfo']; return $this->tag( 'iframe', diff --git a/tests/TestCase/View/Helper/VideoHelperTest.php b/tests/TestCase/View/Helper/VideoHelperTest.php index 8610d7c..fda8fe9 100644 --- a/tests/TestCase/View/Helper/VideoHelperTest.php +++ b/tests/TestCase/View/Helper/VideoHelperTest.php @@ -29,7 +29,7 @@ public function testEmbed() $this->assertEquals($expected, $this->Video->embed('http://example.com', array('failSilently' => true))); // Test embedding a Youtube video. - $expected = ''; + $expected = ''; $this->assertEquals($expected, $this->Video->embed('https://www.youtube.com/watch?v=heNGFmEQVq0')); // Test embedding a Vimeo video. From f898edd6f39f4f39cf33bd8d5fe5f80ae57e774b Mon Sep 17 00:00:00 2001 From: Anto Date: Mon, 14 Sep 2015 13:32:30 +0200 Subject: [PATCH 2/2] update the test with the correct default value for showinfo parameter --- tests/TestCase/View/Helper/VideoHelperTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/TestCase/View/Helper/VideoHelperTest.php b/tests/TestCase/View/Helper/VideoHelperTest.php index fda8fe9..c473a05 100644 --- a/tests/TestCase/View/Helper/VideoHelperTest.php +++ b/tests/TestCase/View/Helper/VideoHelperTest.php @@ -29,7 +29,7 @@ public function testEmbed() $this->assertEquals($expected, $this->Video->embed('http://example.com', array('failSilently' => true))); // Test embedding a Youtube video. - $expected = ''; + $expected = ''; $this->assertEquals($expected, $this->Video->embed('https://www.youtube.com/watch?v=heNGFmEQVq0')); // Test embedding a Vimeo video.