Bugfix: show source tags if not lazyloading

Fixes #25: no source tags would be shown if not lazy loading (on new records/records without any pre-selected tags)
This commit is contained in:
Michael van Schaik 2015-12-30 14:08:18 +01:00
parent 05a1990f20
commit 8412bad2fa

View File

@ -208,16 +208,17 @@ class TagField extends DropdownField
$values = $this->Value();
if (!$values) {
return $options;
// Mark selected tags while still returning a full list of possible options
$ids = array(); // empty fallback array for comparing
$values = $this->Value();
if($values){
// @TODO conversion from array to DataList to array...(?)
if(is_array($values)) {
$values = DataList::create($dataClass)->filter('ID', $values);
}
$ids = $values->column('ID');
}
if (is_array($values)) {
$values = DataList::create($dataClass)->filter('ID', $values);
}
$ids = $values->column('ID');
$titleField = $this->getTitleField();
foreach ($source as $object) {