Skip to content

Commit

Permalink
make HtmlHelper::tag() just return the $text content with no wrapping…
Browse files Browse the repository at this point in the history
… tag when $name === false
  • Loading branch information
openam committed May 20, 2013
1 parent f8c6138 commit 12462b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
Expand Up @@ -1694,6 +1694,9 @@ public function testTag() {

$result = $this->Html->tag('div', '<text>', array('class' => 'class-name', 'escape' => true));
$this->assertTags($result, array('div' => array('class' => 'class-name'), '&lt;text&gt;', '/div'));

$result = $this->Html->tag(false, '<em>stuff</em>');
$this->assertEquals($result, '<em>stuff</em>');
}

/**
Expand Down
3 changes: 3 additions & 0 deletions lib/Cake/View/Helper/HtmlHelper.php
Expand Up @@ -896,6 +896,9 @@ public function tableCells($data, $oddTrOptions = null, $evenTrOptions = null, $
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::tag
*/
public function tag($name, $text = null, $options = array()) {
if ($name === false) {
return $text;
}
if (is_array($options) && isset($options['escape']) && $options['escape']) {
$text = h($text);
unset($options['escape']);
Expand Down

0 comments on commit 12462b2

Please sign in to comment.