Merge pull request #794 from creamarketing/ListboxField_Inconsistency

FIX: ListBoxField and DropdownField should respect getSource()
This commit is contained in:
Will Rossiter 2012-09-14 14:11:01 -07:00
commit 15f40af4eb
2 changed files with 2 additions and 2 deletions

View File

@ -236,7 +236,7 @@ class DropdownField extends FormField {
}
function performReadonlyTransformation() {
$field = new LookupField($this->name, $this->title, $this->source);
$field = new LookupField($this->name, $this->title, $this->getSource());
$field->setValue($this->value);
$field->setForm($this->form);
$field->setReadonly(true);

View File

@ -224,7 +224,7 @@ class ListboxField extends DropdownField {
// They're silently ignored and overwritten the next time the field is saved.
parent::setValue($parts);
} else {
if(!in_array($val, array_keys($this->source))) {
if(!in_array($val, array_keys($this->getSource()))) {
throw new InvalidArgumentException(sprintf(
'Invalid value "%s" for multiple=false',
Convert::raw2xml($val)