diff --git a/modules/json_form_widget/src/ValueHandler.php b/modules/json_form_widget/src/ValueHandler.php index 6d139dfe03..4292d83cb1 100644 --- a/modules/json_form_widget/src/ValueHandler.php +++ b/modules/json_form_widget/src/ValueHandler.php @@ -18,8 +18,8 @@ public function flattenValues($formValues, $property, $schema) { switch ($schema->type) { case 'string': $data = $this->handleStringValues($formValues, $property); - if ($property === 'hasEmail') { - $data = 'mailto:' . ltrim($data ?? '', 'mailto:'); + if ($property === 'hasEmail' && is_string($data)) { + $data = 'mailto:' . ltrim($data, 'mailto:'); } break; @@ -180,10 +180,12 @@ private function cleanSelectId($value) { */ private function getObjectInArrayData($formValues, $property, $schema) { $data = []; - foreach ($formValues[$property][$property] as $key => $item) { - $value = $this->handleObjectValues($formValues[$property][$property][$key][$property], $property, $schema); - if ($value) { - $data[$key] = $value; + if (isset($formValues[$property][$property])) { + foreach ($formValues[$property][$property] as $key => $item) { + $value = $this->handleObjectValues($formValues[$property][$property][$key][$property], $property, $schema); + if ($value) { + $data[$key] = $value; + } } } return $data;