diff --git a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
index 69a76f96eeb..1d43e624d8f 100644
--- a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
@@ -1725,7 +1725,7 @@ public function testMedia() {
);
$this->assertTags($result, $expected);
- $result = $this->Html->media('video.ogv', array('type' => 'video'));
+ $result = $this->Html->media('video.ogv', array('tag' => 'video'));
$expected = array('video' => array('src' => 'files/video.ogv'), '/video');
$this->assertTags($result, $expected);
diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php
index 0126f598f81..d824eb8813d 100644
--- a/lib/Cake/View/Helper/HtmlHelper.php
+++ b/lib/Cake/View/Helper/HtmlHelper.php
@@ -991,9 +991,9 @@ public function para($class, $text, $options = array()) {
* Using multiple video files:
*
* {{{
- * echo $this->Html->video(
+ * echo $this->Html->media(
* array('video.mp4', array('src' => 'video.ogv', 'type' => "video/ogg; codecs='theora, vorbis'")),
- * array('type' => 'video', 'autoplay')
+ * array('tag' => 'video', 'autoplay')
* );
* }}}
*
@@ -1008,8 +1008,8 @@ public function para($class, $text, $options = array()) {
*
* ### Options
*
- * - `type` Type of media element to generate, valid values are "audio" or "video".
- * If type is not provided media type is guessed based on file's mime type.
+ * - `tag` Type of media element to generate, either "audio" or "video".
+ * If tag is not provided it's guessed based on file's mime type.
* - `text` Text to include inside the audio/video tag
* - `pathPrefix` Path prefix to use for relative urls, defaults to 'files/'
* - `fullBase` If provided the src attribute will get a full address including domain name
@@ -1017,15 +1017,19 @@ public function para($class, $text, $options = array()) {
* @param string|array $path Path to the video file, relative to the webroot/{$options['pathPrefix']} directory.
* Or an array where each item itself can be a path string or an associate array containing keys `src` and `type`
* @param array $options Array of HTML attributes, and special options above.
- * @return string Generated video tag
+ * @return string Generated media element
*/
public function media($path, $options = array()) {
- $options += array('type' => null, 'pathPrefix' => 'files/', 'text' => '');
+ $options += array(
+ 'tag' => null,
+ 'pathPrefix' => 'files/',
+ 'text' => ''
+ );
- if (!empty($options['type'])) {
- $type = $options['type'];
+ if (!empty($options['tag'])) {
+ $tag = $options['tag'];
} else {
- $type = null;
+ $tag = null;
}
if (is_array($path)) {
@@ -1053,16 +1057,16 @@ public function media($path, $options = array()) {
$options['src'] = $this->assetUrl($path, $options);
}
- if ($type === null) {
+ if ($tag === null) {
if (is_array($path)) {
$mimeType = $path[0]['type'];
} else {
$mimeType = $this->response->getMimeType(pathinfo($path, PATHINFO_EXTENSION));
}
if (preg_match('#^video/#', $mimeType)) {
- $type = 'video';
+ $tag = 'video';
} else {
- $type = 'audio';
+ $tag = 'audio';
}
}
@@ -1072,12 +1076,12 @@ public function media($path, $options = array()) {
$text = $options['text'];
$options = array_diff_key($options, array(
- 'type' => '',
+ 'tag' => '',
'fullBase' => '',
'pathPrefix' => '',
'text' => ''
));
- return $this->tag($type, $text, $options);
+ return $this->tag($tag, $text, $options);
}
/**