mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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
This commit is contained in:
parent
bbb0868227
commit
54d8abcdc7
@ -236,7 +236,7 @@ class DropdownField extends FormField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function performReadonlyTransformation() {
|
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->setValue($this->value);
|
||||||
$field->setForm($this->form);
|
$field->setForm($this->form);
|
||||||
$field->setReadonly(true);
|
$field->setReadonly(true);
|
||||||
|
@ -224,7 +224,7 @@ class ListboxField extends DropdownField {
|
|||||||
// They're silently ignored and overwritten the next time the field is saved.
|
// They're silently ignored and overwritten the next time the field is saved.
|
||||||
parent::setValue($parts);
|
parent::setValue($parts);
|
||||||
} else {
|
} else {
|
||||||
if(!in_array($val, array_keys($this->source))) {
|
if(!in_array($val, array_keys($this->getSource()))) {
|
||||||
throw new InvalidArgumentException(sprintf(
|
throw new InvalidArgumentException(sprintf(
|
||||||
'Invalid value "%s" for multiple=false',
|
'Invalid value "%s" for multiple=false',
|
||||||
Convert::raw2xml($val)
|
Convert::raw2xml($val)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user