From bc7bf5265b1607c9af466c8092f9d4ef05096afd Mon Sep 17 00:00:00 2001 From: Roman Schmid Date: Tue, 28 Jun 2022 09:29:32 +0200 Subject: [PATCH] fix: Deal with DataObjects or Int values, so that the correct value is shown with has_one --- src/TagField.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/TagField.php b/src/TagField.php index 177ab23..7e45d46 100644 --- a/src/TagField.php +++ b/src/TagField.php @@ -402,6 +402,14 @@ class TagField extends MultiSelectField return $values->column($this->getTitleField()); } + if ($values instanceof DataObject && $values->exists()) { + return [$values->ID]; + } + + if (is_int($values)) { + return [$values]; + } + return [trim((string) $values)]; }