mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Only clear the unlocked fields on end().
Doing this work on end() allows fields to be unlocked before the form is created which can be helpful. Refs #8880
This commit is contained in:
parent
b15560ea0c
commit
e78af35af7
2 changed files with 4 additions and 2 deletions
|
@ -1608,8 +1608,10 @@ class FormHelperTest extends CakeTestCase {
|
|||
'unlockedFields' => array()
|
||||
);
|
||||
|
||||
$this->Form->create('Contact');
|
||||
$this->Form->unlockField('Contact.id');
|
||||
$this->Form->create('Contact');
|
||||
$this->Form->hidden('Contact.id', array('value' => 1));
|
||||
$this->assertEmpty($this->Form->fields, 'Field should be unlocked');
|
||||
$this->Form->end();
|
||||
|
||||
$this->Form->create('Contact');
|
||||
|
|
|
@ -467,7 +467,6 @@ class FormHelper extends AppHelper {
|
|||
$htmlAttributes = array_merge($options, $htmlAttributes);
|
||||
|
||||
$this->fields = array();
|
||||
$this->_unlockedFields = array();
|
||||
if ($this->requestType !== 'get') {
|
||||
$append .= $this->_csrfField();
|
||||
}
|
||||
|
@ -561,6 +560,7 @@ class FormHelper extends AppHelper {
|
|||
$this->setEntity(null);
|
||||
$out .= $this->Html->useTag('formend');
|
||||
|
||||
$this->_unlockedFields = array();
|
||||
$this->_View->modelScope = false;
|
||||
$this->requestType = null;
|
||||
return $out;
|
||||
|
|
Loading…
Reference in a new issue