mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
fix for FormHelper:create()
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3997 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
f5cdfcfd32
commit
083a3bf990
1 changed files with 7 additions and 3 deletions
|
@ -87,8 +87,8 @@ class FormHelper extends AppHelper {
|
|||
'key' => $object->primaryKey,
|
||||
'validates' => array_keys($object->validate)
|
||||
);
|
||||
|
||||
if (isset($this->data[$model]) && isset($this->data[$model][$object['key']]) && !empty($this->data[$model][$object['key']])) {
|
||||
|
||||
if (isset($this->data[$model]) && isset($this->data[$model][$data['key']]) && !empty($this->data[$model][$data['key']])) {
|
||||
$created = true;
|
||||
}
|
||||
$options = am(array('type' => ($created && empty($options['action'])) ? 'put' : 'post', 'id' => $model . 'Form', 'action' => array()), $options);
|
||||
|
@ -237,6 +237,8 @@ class FormHelper extends AppHelper {
|
|||
if (isset($options['label'])) {
|
||||
$label = $options['label'];
|
||||
unset($options['label']);
|
||||
} else {
|
||||
$label = Inflector::humanize($this->field());
|
||||
}
|
||||
|
||||
$out = $this->label($tagName, $label);
|
||||
|
@ -245,7 +247,9 @@ class FormHelper extends AppHelper {
|
|||
if (isset($options['error'])) {
|
||||
$error = $options['error'];
|
||||
unset($options['error']);
|
||||
}
|
||||
} else {
|
||||
$error = $label . ' is required';
|
||||
}
|
||||
|
||||
$selected = null;
|
||||
if (isset($options['selected'])) {
|
||||
|
|
Loading…
Add table
Reference in a new issue