Skip to content

Commit 93bf670

Browse files
committed
throw invalid show text format
1 parent c9ae0b5 commit 93bf670

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Show/Fields/Formatters/TextFormatter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Code16\Sharp\Show\Fields\Formatters;
44

5+
use Code16\Sharp\Exceptions\Form\SharpFormFieldDataException;
56
use Code16\Sharp\Show\Fields\SharpShowField;
67
use Code16\Sharp\Show\Fields\SharpShowTextField;
78
use 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(

src/Utils/Fields/Formatters/FormatsLocalizedValue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)