Skip to content

Commit

Permalink
Allowed specifying media path using 'src' attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Feb 10, 2012
1 parent bea50f5 commit be694d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
Expand Up @@ -1743,6 +1743,13 @@ public function testMedia() {
'/video'
);
$this->assertTags($result, $expected);

$result = $this->Html->media(null, array('src' => 'video.webm'));
$expected = array(
'video' => array('src' => 'files/video.webm'),
'/video'
);
$this->assertTags($result, $expected);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions lib/Cake/View/Helper/HtmlHelper.php
Expand Up @@ -1047,6 +1047,9 @@ public function media($path, $options = array()) {
$options['text'] = $sourceTags . $options['text'];
unset($options['fullBase']);
} else {
if (empty($path) && !empty($options['src'])) {
$path = $options['src'];
}
$options['src'] = $this->assetUrl($path, $options);
}

Expand Down

0 comments on commit be694d8

Please sign in to comment.