Skip to content

Commit

Permalink
Bug:ListBoxField and DropdownField does not respect getSource in all …
Browse files Browse the repository at this point in the history
…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
tom890180 committed Sep 14, 2012
1 parent bbb0868 commit 54d8abc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion forms/DropdownField.php
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion forms/ListboxField.php
Expand Up @@ -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)
Expand Down

0 comments on commit 54d8abc

Please sign in to comment.