Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…eo-helper

# By Anto (1) and antograssiot (1)
# Via Andy Carter (1) and Anto (1)
* 'master' of https://github.com/drmonkeyninja/cakephp-video-helper:
  update the test with the correct default value for showinfo parameter
  add the `showinfo` option for youtube
  • Loading branch information
Andy Carter committed Sep 15, 2015
2 parents dc850cc + 00d4201 commit 0b644b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/View/Helper/VideoHelper.php
Expand Up @@ -85,7 +85,8 @@ public function youtube($url, $settings = array())
'allowfullscreen' => true,
'frameborder' => 0,
'related' => false,
'autoplay' => false
'autoplay' => false,
'showinfo' => true,
);

$settings = array_merge($defaultSettings, $settings);
Expand All @@ -95,7 +96,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',
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/View/Helper/VideoHelperTest.php
Expand Up @@ -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 = '<iframe width="624" height="369" src="//www.youtube.com/embed/heNGFmEQVq0?hd=1&amp;rel=0&amp;autoplay=0" frameborder="0" allowfullscreen="allowfullscreen"></iframe>';
$expected = '<iframe width="624" height="369" src="//www.youtube.com/embed/heNGFmEQVq0?hd=1&amp;rel=0&amp;autoplay=0&amp;showinfo=1" frameborder="0" allowfullscreen="allowfullscreen"></iframe>';
$this->assertEquals($expected, $this->Video->embed('https://www.youtube.com/watch?v=heNGFmEQVq0'));

// Test embedding a Vimeo video.
Expand Down

0 comments on commit 0b644b6

Please sign in to comment.