From be694d8d6bd0b6ad1bc814b93db4cf7129a73cf3 Mon Sep 17 00:00:00 2001 From: ADmad Date: Fri, 10 Feb 2012 13:06:55 +0530 Subject: [PATCH] Allowed specifying media path using 'src' attribute --- lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php | 7 +++++++ lib/Cake/View/Helper/HtmlHelper.php | 3 +++ 2 files changed, 10 insertions(+) diff --git a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php index afafbe678..69a76f96e 100644 --- a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php @@ -1743,6 +1743,13 @@ class HtmlHelperTest extends CakeTestCase { '/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); } /** diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index 1b8d030f9..0126f598f 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -1047,6 +1047,9 @@ class HtmlHelper extends AppHelper { $options['text'] = $sourceTags . $options['text']; unset($options['fullBase']); } else { + if (empty($path) && !empty($options['src'])) { + $path = $options['src']; + } $options['src'] = $this->assetUrl($path, $options); }