mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
make HtmlHelper::tag() just return the $text content with no wrapping tag when $name === false
This commit is contained in:
parent
f8c6138ad7
commit
12462b2e51
2 changed files with 6 additions and 0 deletions
|
@ -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'), '<text>', '/div'));
|
||||
|
||||
$result = $this->Html->tag(false, '<em>stuff</em>');
|
||||
$this->assertEquals($result, '<em>stuff</em>');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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']);
|
||||
|
|
Loading…
Reference in a new issue