From d7d199359230e79276b11e8fbd262171eaa4d436 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Fri, 20 Dec 2024 11:33:31 -0500 Subject: [PATCH] remove empty item for all modes --- modules/backend/formwidgets/TagList.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/backend/formwidgets/TagList.php b/modules/backend/formwidgets/TagList.php index 6b87e59a7..9773cb3d7 100644 --- a/modules/backend/formwidgets/TagList.php +++ b/modules/backend/formwidgets/TagList.php @@ -110,6 +110,10 @@ public function prepareVars() */ public function getSaveValue($value) { + if (is_array($value)) { + $value = array_filter($value); + } + if ($this->mode === static::MODE_RELATION) { return $this->hydrateRelationSaveValue($value); } @@ -131,8 +135,6 @@ protected function hydrateRelationSaveValue($names): ?array $names = [$names]; } - $names = array_filter($names); - $relation = $this->getRelationObject(); $relationModel = $this->getRelationModel();