Permalink
Browse files

Bug:ListBoxField and DropdownField does not respect getSource in all …

…Places

In some places source is referenced directly and assumed to be array, while in some places the getSource() method is used instead.
By changing this you have more freedom when extending these classes
  • Loading branch information...
1 parent bbb0868 commit 54d8abcdc72c6dcfb91a16959ad454fdf7e9cc58 Tom committed Sep 14, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 forms/DropdownField.php
  2. +1 −1 forms/ListboxField.php
@@ -236,7 +236,7 @@ function getEmptyString() {
}
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);
@@ -224,7 +224,7 @@ function setValue($val, $obj = null) {
// 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)

0 comments on commit 54d8abc

Please sign in to comment.