mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +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
|
@ -88,7 +88,7 @@ class FormHelper extends AppHelper {
|
||||||
'validates' => array_keys($object->validate)
|
'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;
|
$created = true;
|
||||||
}
|
}
|
||||||
$options = am(array('type' => ($created && empty($options['action'])) ? 'put' : 'post', 'id' => $model . 'Form', 'action' => array()), $options);
|
$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'])) {
|
if (isset($options['label'])) {
|
||||||
$label = $options['label'];
|
$label = $options['label'];
|
||||||
unset($options['label']);
|
unset($options['label']);
|
||||||
|
} else {
|
||||||
|
$label = Inflector::humanize($this->field());
|
||||||
}
|
}
|
||||||
|
|
||||||
$out = $this->label($tagName, $label);
|
$out = $this->label($tagName, $label);
|
||||||
|
@ -245,6 +247,8 @@ class FormHelper extends AppHelper {
|
||||||
if (isset($options['error'])) {
|
if (isset($options['error'])) {
|
||||||
$error = $options['error'];
|
$error = $options['error'];
|
||||||
unset($options['error']);
|
unset($options['error']);
|
||||||
|
} else {
|
||||||
|
$error = $label . ' is required';
|
||||||
}
|
}
|
||||||
|
|
||||||
$selected = null;
|
$selected = null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue