From 12462b2e51fc62512b8ccc6f41b9118f76e1f50d Mon Sep 17 00:00:00 2001 From: Michael Tuttle Date: Sun, 19 May 2013 22:00:27 -0600 Subject: [PATCH] make HtmlHelper::tag() just return the $text content with no wrapping tag when $name === false --- lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php | 3 +++ lib/Cake/View/Helper/HtmlHelper.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php index 316c6183802..36500dcd1d7 100644 --- a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php @@ -1694,6 +1694,9 @@ public function testTag() { $result = $this->Html->tag('div', '', array('class' => 'class-name', 'escape' => true)); $this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div')); + + $result = $this->Html->tag(false, 'stuff'); + $this->assertEquals($result, 'stuff'); } /** diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index 80d7e8221e1..b61e5ba20c0 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -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']);