diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index fa7b75da4..2fd7c9866 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -792,14 +792,32 @@ class FormHelperTest extends CakeTestCase { $this->Form->request['_Token'] = array('key' => $key); $result = $this->Form->secure($fields); - $expected = Security::hash(serialize($fields) . Configure::read('Security.salt')); - $expected .= ':' . 'Model.valid'; + $hash = Security::hash(serialize($fields) . Configure::read('Security.salt')); + $hash .= ':' . 'Model.valid'; + $hash = urlencode($hash); $expected = array( 'div' => array('style' => 'display:none;'), array('input' => array( 'type' => 'hidden', 'name' => 'data[_Token][fields]', - 'value' => urlencode($expected), 'id' => 'preg:/TokenFields\d+/' + 'value' => $hash, 'id' => 'preg:/TokenFields\d+/' + )), + array('input' => array( + 'type' => 'hidden', 'name' => 'data[_Token][unlocked]', + 'value' => '', 'id' => 'preg:/TokenUnlocked\d+/' + )), + '/div' + ); + $this->assertTags($result, $expected); + + $path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS; + $this->Form->Html->loadConfig('htmlhelper_tags', $path); + $result = $this->Form->secure($fields); + $expected = array( + 'div' => array('class' => 'hidden'), + array('input' => array( + 'type' => 'hidden', 'name' => 'data[_Token][fields]', + 'value' => $hash, 'id' => 'preg:/TokenFields\d+/' )), array('input' => array( 'type' => 'hidden', 'name' => 'data[_Token][unlocked]', diff --git a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php index fd4cb0a77..fcb299071 100644 --- a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php @@ -1863,7 +1863,8 @@ class HtmlHelperTest extends CakeTestCase { $expected = array( 'tags' => array( 'form' => 'start form', - 'formend' => 'finish form' + 'formend' => 'finish form', + 'hiddenblock' => '' ) ); $this->assertEquals($expected, $result); diff --git a/lib/Cake/Test/test_app/Config/htmlhelper_tags.php b/lib/Cake/Test/test_app/Config/htmlhelper_tags.php index abff9cdf5..850f26d12 100644 --- a/lib/Cake/Test/test_app/Config/htmlhelper_tags.php +++ b/lib/Cake/Test/test_app/Config/htmlhelper_tags.php @@ -3,6 +3,7 @@ $config = array( 'tags' => array( 'form' => 'start form', - 'formend' => 'finish form' + 'formend' => 'finish form', + 'hiddenblock' => '' ) ); \ No newline at end of file diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 6431a0ad0..a1066a15d 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -428,7 +428,7 @@ class FormHelper extends AppHelper { $append .= $this->_csrfField(); if (!empty($append)) { - $append = $this->Html->useTag('block', ' style="display:none;"', $append); + $append = $this->Html->useTag('hiddenblock', $append); } if ($model !== false) { @@ -545,7 +545,7 @@ class FormHelper extends AppHelper { 'value' => urlencode($unlocked), 'id' => 'TokenUnlocked' . mt_rand() )); - return $this->Html->useTag('block', ' style="display:none;"', $out); + return $this->Html->useTag('hiddenblock', $out); } /** diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index fb53cf340..8cf545748 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -78,6 +78,7 @@ class HtmlHelper extends AppHelper { 'block' => '%s', 'blockstart' => '', 'blockend' => '', + 'hiddenblock' => '
%s
', 'tag' => '<%s%s>%s', 'tagstart' => '<%s%s>', 'tagend' => '',