[Form] Replace unset() with non-destructive logic in case the "choices" option is an object.
This commit is contained in:
parent
50f039844b
commit
6fc9b68fa7
@ -43,11 +43,12 @@ class ChoiceField extends HybridField
|
||||
|
||||
foreach ($this->getOption('preferred_choices') as $choice) {
|
||||
$this->add($this->newChoiceField($choice, $choices[$choice]));
|
||||
unset($choices[$choice]);
|
||||
}
|
||||
|
||||
foreach ($this->getOption('choices') as $choice => $value) {
|
||||
$this->add($this->newChoiceField($choice, $value));
|
||||
if (!isset($this->preferredChoices[$choice])) {
|
||||
$this->add($this->newChoiceField($choice, $value));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->setFieldMode(self::FIELD);
|
||||
|
Reference in New Issue
Block a user