Browse Source

Restore the ability to create arbirtary meta tags.

This behavior was lacking a test case, and was accidentally removed in
a5feef9.

Refs #4903
Mark Story 11 years ago
parent
commit
b073213a8b
2 changed files with 7 additions and 7 deletions
  1. 4 4
      src/View/Helper/HtmlHelper.php
  2. 3 3
      tests/TestCase/View/Helper/HtmlHelperTest.php

+ 4 - 4
src/View/Helper/HtmlHelper.php

@@ -228,16 +228,16 @@ class HtmlHelper extends Helper {
 		if (isset($types[$type])) {
 			$type = $types[$type];
 		} elseif (!isset($options['type']) && $content !== null) {
-			if (is_array($content) && isset($content['ext'])) {
-				$type = $types[$content['ext']];
+			if (is_array($content) && isset($content['_ext'])) {
+				$type = $types[$content['_ext']];
 			} else {
-				$type = $types['rss'];
+				$type = ['name' => $type, 'content' => $content];
 			}
 		} elseif (isset($options['type']) && isset($types[$options['type']])) {
 			$type = $types[$options['type']];
 			unset($options['type']);
 		} else {
-			$type = array();
+			$type = [];
 		}
 
 		$options += $type;

+ 3 - 3
tests/TestCase/View/Helper/HtmlHelperTest.php

@@ -1534,11 +1534,11 @@ class HtmlHelperTest extends TestCase {
 		$this->assertHtml($expected, $result);
 
 		$result = $this->Html->meta('non-existing');
-		$expected = array('<meta');
+		$expected = ['<meta'];
 		$this->assertHtml($expected, $result);
 
-		$result = $this->Html->meta('non-existing', '/posts.xpp');
-		$expected = array('link' => array('href' => 'preg:/.*\/posts\.xpp/', 'type' => 'application/rss+xml', 'rel' => 'alternate', 'title' => 'non-existing'));
+		$result = $this->Html->meta('non-existing', 'some content');
+		$expected = ['meta' => ['name' => 'non-existing', 'content' => 'some content']];
 		$this->assertHtml($expected, $result);
 
 		$result = $this->Html->meta('non-existing', '/posts.xpp', array('type' => 'atom'));