mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
fixing some changes to FormHelper
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4769 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
aeac37e707
commit
f49183f70e
1 changed files with 6 additions and 22 deletions
|
@ -109,7 +109,6 @@ class FormHelper extends AppHelper {
|
|||
$data = array(
|
||||
'fields' => array_combine($fields->extract('{n}.name'), $fields->extract('{n}.type')),
|
||||
'sizes' => array_combine($fields->extract('{n}.name'), $fields->extract('{n}.length')),
|
||||
'values' => array_combine($fields->extract('{n}.name'), $fields->extract('{n}.default')),
|
||||
'key' => $object->primaryKey,
|
||||
'validates' => (ife(empty($object->validate), array(), array_keys($object->validate)))
|
||||
);
|
||||
|
@ -331,7 +330,6 @@ class FormHelper extends AppHelper {
|
|||
|
||||
if (!isset($options['type'])) {
|
||||
$options['type'] = 'text';
|
||||
|
||||
if (isset($options['options'])) {
|
||||
$options['type'] = 'select';
|
||||
} elseif (in_array($this->field(), array('passwd', 'password'))) {
|
||||
|
@ -362,23 +360,12 @@ class FormHelper extends AppHelper {
|
|||
}
|
||||
}
|
||||
|
||||
if(!array_key_exists('size', $options)) {
|
||||
if(isset($this->fieldset['sizes'][$this->field()])) {
|
||||
$options['size'] = $this->fieldset['sizes'][$this->field()];
|
||||
}
|
||||
}
|
||||
if(!array_key_exists('maxlength', $options)) {
|
||||
if(!array_key_exists('maxlength', $options) && $options['type'] == 'text') {
|
||||
if(isset($this->fieldset['sizes'][$this->field()])) {
|
||||
$options['maxlength'] = $this->fieldset['sizes'][$this->field()];
|
||||
}
|
||||
}
|
||||
|
||||
if(!array_key_exists('value', $options)) {
|
||||
if(isset($this->fieldset['values'][$this->field()])) {
|
||||
$options['value'] = $this->fieldset['values'][$this->field()];
|
||||
}
|
||||
}
|
||||
|
||||
$out = '';
|
||||
$div = true;
|
||||
if (array_key_exists('div', $options)) {
|
||||
|
@ -387,20 +374,17 @@ class FormHelper extends AppHelper {
|
|||
}
|
||||
|
||||
if(!empty($div)) {
|
||||
$divOptions = array();
|
||||
if ( !in_array($this->field(), $this->fieldset['validates'])) {
|
||||
$divOptions['class'] = 'input';
|
||||
} elseif (in_array($this->field(), $this->fieldset['validates'])) {
|
||||
$divOptions['class'] = 'required';
|
||||
}
|
||||
|
||||
$divOptions = array('class'=>'input');
|
||||
if (is_string($div)) {
|
||||
$divOptions['class'] = $div;
|
||||
} elseif (is_array($div)) {
|
||||
$divOptions = am($divOptions, $div);
|
||||
}
|
||||
if (in_array($this->field(), $this->fieldset['validates'])) {
|
||||
$divOptions = $this->addClass($divOptions, 'required');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$label = null;
|
||||
if (isset($options['label'])) {
|
||||
$label = $options['label'];
|
||||
|
|
Loading…
Reference in a new issue