mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 19:38:26 +00:00
Fixing issue in FormHelper::select() with $options array numeric keys being reset
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3394 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
9c75c34b62
commit
02ed400c61
1 changed files with 6 additions and 2 deletions
|
@ -243,11 +243,14 @@ class FormHelper extends Helper {
|
|||
}
|
||||
|
||||
if ($showEmpty !== null && $showEmpty !== false) {
|
||||
array_unshift($options, array('name' => $showEmpty, 'value' => ''));
|
||||
$keys = array_keys($options);
|
||||
$vals = array_values($options);
|
||||
array_unshift($keys, '');
|
||||
array_unshift($vals, $showEmpty);
|
||||
$options = array_combine($keys, $vals);
|
||||
}
|
||||
|
||||
$select = am($select, $this->selectOptions($options, $selected));
|
||||
|
||||
$select[] = sprintf($this->tags['selectend']);
|
||||
return $this->output(implode("\n", $select));
|
||||
}
|
||||
|
@ -279,6 +282,7 @@ class FormHelper extends Helper {
|
|||
}
|
||||
|
||||
if ($name !== null) {
|
||||
pr($name);
|
||||
if (($selected !== null) && ($selected == $name)) {
|
||||
$htmlOptions['selected'] = 'selected';
|
||||
} else if(is_array($selected) && in_array($name, $selected)) {
|
||||
|
|
Loading…
Reference in a new issue