make HtmlHelper::tag() just return the $text content with no wrapping tag when $name === false

This commit is contained in:
Michael Tuttle 2013-05-19 22:00:27 -06:00
parent f8c6138ad7
commit 12462b2e51
2 changed files with 6 additions and 0 deletions

View file

@ -1694,6 +1694,9 @@ class HtmlHelperTest extends CakeTestCase {
$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>');
}
/**

View file

@ -896,6 +896,9 @@ class HtmlHelper extends AppHelper {
* @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']);