From 33b4159e6c93466ad13ff434e8a6e47961910685 Mon Sep 17 00:00:00 2001 From: Ivo Valchev Date: Fri, 26 Jun 2020 13:02:08 +0200 Subject: [PATCH] Fix issue with undefined index 0 for a select field inside a a set --- src/Controller/Backend/ContentEditController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Controller/Backend/ContentEditController.php b/src/Controller/Backend/ContentEditController.php index 3d13a45f6..ed0bb7289 100644 --- a/src/Controller/Backend/ContentEditController.php +++ b/src/Controller/Backend/ContentEditController.php @@ -420,11 +420,6 @@ private function updateField(Field $field, $value, ?string $locale): void $field->setLocale($this->defaultLocale); } - // If the value is an array that contains a string of JSON, parse it - if (is_iterable($value) && Json::test(current($value))) { - $value = Json::findArray($value); - } - if ($field instanceof SetField) { foreach ($value as $name => $svalue) { $child = $field->getValueForEditor()[$name]; @@ -438,6 +433,11 @@ private function updateField(Field $field, $value, ?string $locale): void $this->updateField($child, $svalue, $locale); } } else { + // If the value is an array that contains a string of JSON, parse it + if (is_iterable($value) && Json::test(current($value))) { + $value = Json::findArray($value); + } + $field->setValue($value); }