From f8459b4c76ab9bb22c95c336f665818afb6837c0 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Wed, 8 May 2024 17:17:13 -0400 Subject: [PATCH] Fix taglist formwidget in relation mode for empty tags (#1123) Co-authored-by: Luke Towers --- modules/backend/widgets/Form.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/backend/widgets/Form.php b/modules/backend/widgets/Form.php index cd70308c7e..59ec24e033 100644 --- a/modules/backend/widgets/Form.php +++ b/modules/backend/widgets/Form.php @@ -1225,7 +1225,14 @@ public function getSaveData(bool $includeAllFields = false): array continue; } - $widgetValue = $widget->getSaveValue($this->dataArrayGet($result, $parts, FormField::NO_SAVE_DATA)); + // Exclude fields that didn't provide any value + $fieldValue = $this->dataArrayGet($result, $parts, FormField::NO_SAVE_DATA); + if ($fieldValue === FormField::NO_SAVE_DATA) { + continue; + } + + // Exclude fields where the widget returns NO_SAVE_DATA + $widgetValue = $widget->getSaveValue($fieldValue); if ($widgetValue === FormField::NO_SAVE_DATA) { continue; }