| @@ -100,9 +100,9 @@ | ||
| 100 | 100 | * @return bool |
| 101 | 101 | */ |
| 102 | 102 | public static function fieldTypeHasOptions(string $fieldType): bool |
| 103 | 103 | { |
| 104 | - return in_array($fieldType, ['radio', 'checkbox', 'select', 'multi-select'], true); | |
| 104 | + return in_array($fieldType, ['radio', 'checkbox', 'select', 'multi-select', 'product', 'rating'], true); | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | 108 | * Check if a field type is a security/CAPTCHA field. |
| @@ -157,6 +157,25 @@ | ||
| 157 | 157 | 'field' |
| 158 | 158 | ); |
| 159 | 159 | $fieldData['htmlContent'] = $processedContent; |
| 160 | 160 | } |
| 161 | + } | |
| 162 | + | |
| 163 | + /** | |
| 164 | + * Upload base64 images in rich text default values before form save. | |
| 165 | + * | |
| 166 | + * @param array<string, mixed> $fieldData Passed by reference; defaultValue modified in place | |
| 167 | + * @param ImageService $imageService | |
| 168 | + * @return void | |
| 169 | + */ | |
| 170 | + public static function processRichTextDefaultValue(array &$fieldData, ImageService $imageService): void | |
| 171 | + { | |
| 172 | + if (($fieldData['type'] ?? '') !== 'rich_text' || empty($fieldData['defaultValue'])) { | |
| 173 | + return; | |
| 174 | + } | |
| 175 | + | |
| 176 | + $fieldData['defaultValue'] = $imageService->processImagesInContent( | |
| 177 | + (string) $fieldData['defaultValue'], | |
| 178 | + 'field' | |
| 179 | + ); | |
| 161 | 180 | } |
| 162 | 181 | } |