Skip to content
This repository
Browse code

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

… tag when $name === false
  • Loading branch information...
commit 12462b2e51fc62512b8ccc6f41b9118f76e1f50d 1 parent f8c6138
Michael Tuttle authored
3  lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
@@ -1694,6 +1694,9 @@ public function testTag() {
1694 1694
 
1695 1695
 		$result = $this->Html->tag('div', '<text>', array('class' => 'class-name', 'escape' => true));
1696 1696
 		$this->assertTags($result, array('div' => array('class' => 'class-name'), '&lt;text&gt;', '/div'));
  1697
+
  1698
+		$result = $this->Html->tag(false, '<em>stuff</em>');
  1699
+		$this->assertEquals($result, '<em>stuff</em>');
1697 1700
 	}
1698 1701
 
1699 1702
 /**
3  lib/Cake/View/Helper/HtmlHelper.php
@@ -896,6 +896,9 @@ public function tableCells($data, $oddTrOptions = null, $evenTrOptions = null, $
896 896
  * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::tag
897 897
  */
898 898
 	public function tag($name, $text = null, $options = array()) {
  899
+		if ($name === false) {
  900
+			return $text;
  901
+		}
899 902
 		if (is_array($options) && isset($options['escape']) && $options['escape']) {
900 903
 			$text = h($text);
901 904
 			unset($options['escape']);

0 notes on commit 12462b2

Please sign in to comment.
Something went wrong with that request. Please try again.