File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change 22
33namespace Code16 \Sharp \Show \Fields \Formatters ;
44
5+ use Code16 \Sharp \Exceptions \Form \SharpFormFieldDataException ;
56use Code16 \Sharp \Show \Fields \SharpShowField ;
67use Code16 \Sharp \Show \Fields \SharpShowTextField ;
78use Code16 \Sharp \Utils \Fields \Formatters \FormatsEditorEmbeds ;
@@ -15,9 +16,12 @@ class TextFormatter extends SharpShowFieldFormatter
1516
1617 /**
1718 * @param SharpShowTextField $field
19+ * @throws SharpFormFieldDataException
1820 */
1921 public function toFront (SharpShowField $ field , $ value )
2022 {
23+ $ this ->guardAgainstInvalidLocalizedValue ($ field , $ value );
24+
2125 return collect (['text ' => $ value ])
2226 ->pipeThrough ([
2327 fn (Collection $ collection ) => $ collection ->merge (
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ public function setDataLocalizations(array $dataLocalizations): static
2222 /**
2323 * @throws SharpFormFieldDataException
2424 */
25- protected function guardAgainstInvalidLocalizedValue (SharpFormField $ field , $ value ): void
25+ protected function guardAgainstInvalidLocalizedValue (SharpFormField | SharpShowField $ field , $ value ): void
2626 {
2727 if (!$ field instanceof IsSharpFieldWithLocalization) {
2828 return ;
You can’t perform that action at this time.
0 commit comments