Permalink
Browse files

make HtmlHelper::tag() just return the $text content with no wrapping…

… tag when $name === false
  • Loading branch information...
1 parent f8c6138 commit 12462b2e51fc62512b8ccc6f41b9118f76e1f50d @openam openam committed May 20, 2013
Showing with 6 additions and 0 deletions.
  1. +3 −0 lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
  2. +3 −0 lib/Cake/View/Helper/HtmlHelper.php
@@ -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>');
}
/**
@@ -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']);

0 comments on commit 12462b2

Please sign in to comment.