mirror of
https://github.com/silverstripe/silverstripe-tagfield
synced 2024-10-22 11:05:32 +02:00
FIX Use existing source datalist if available before creating a new one
Fix for #171 - Issue when utilizing multiple of same parent class Co-authored-by: Joe Madden <joe.madden@moosylvania.com>
This commit is contained in:
parent
43ccb16def
commit
55e03731bf
@ -275,8 +275,12 @@ class TagField extends MultiSelectField
|
||||
// Convert an array of values into a datalist of options
|
||||
if (!$values instanceof SS_List) {
|
||||
if (is_array($values) && !empty($values)) {
|
||||
$values = DataList::create($dataClass)
|
||||
->filter($this->getTitleField(), $values);
|
||||
if (is_a($source, DataList::class)) {
|
||||
$values = $source->filter($this->getTitleField(), $values);
|
||||
} else {
|
||||
$values = DataList::create($dataClass)
|
||||
->filter($this->getTitleField(), $values);
|
||||
}
|
||||
} else {
|
||||
$values = ArrayList::create();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user