diff --git a/code/TagField.php b/code/TagField.php index 3249701..5b60250 100644 --- a/code/TagField.php +++ b/code/TagField.php @@ -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) {