Skip to content

Commit

Permalink
Restore the ability to create arbirtary meta tags.
Browse files Browse the repository at this point in the history
This behavior was lacking a test case, and was accidentally removed in
a5feef9.

Refs #4903
  • Loading branch information
markstory committed Oct 17, 2014
1 parent 491c0c2 commit b073213
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/View/Helper/HtmlHelper.php
Expand Up @@ -228,16 +228,16 @@ public function meta($type, $content = null, array $options = array()) {
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;
Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase/View/Helper/HtmlHelperTest.php
Expand Up @@ -1534,11 +1534,11 @@ public function testMeta() {
$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'));
Expand Down

0 comments on commit b073213

Please sign in to comment.