diff --git a/modules/json_form_widget/src/ValueHandler.php b/modules/json_form_widget/src/ValueHandler.php index 419f8b3525..0d5aa2d65e 100644 --- a/modules/json_form_widget/src/ValueHandler.php +++ b/modules/json_form_widget/src/ValueHandler.php @@ -51,6 +51,10 @@ public function handleStringValues($formValues, $property) { if (isset($formValues[$property]['select'])) { return $formValues[$property][0] ?? NULL; } + // Handle text_format + if (isset($formValues[$property]['value'])) { + return $formValues[$property]['value']; + } return !empty($formValues[$property]) && is_string($formValues[$property]) ? $this->cleanSelectId($formValues[$property]) : FALSE; } diff --git a/modules/json_form_widget/src/WidgetRouter.php b/modules/json_form_widget/src/WidgetRouter.php index 0193018400..ac8391d7e7 100644 --- a/modules/json_form_widget/src/WidgetRouter.php +++ b/modules/json_form_widget/src/WidgetRouter.php @@ -307,6 +307,13 @@ public function handleUploadOrLinkElement($spec, array $element) { */ public function handleTextareaElement($spec, array $element) { $element['#type'] = 'textarea'; + if ($spec->text_format) { + $element['#type'] = 'text_format'; + $element['#format'] = $spec->text_format; + $element['#allowed_formats'] = [ + $spec->text_format + ]; + } if (isset($spec->rows)) { $element['#rows'] = $spec->rows; }