22
33namespace Code16 \Sharp \Show \Fields ;
44
5+ use Code16 \Sharp \Show \Fields \Formatters \SharpShowFieldFormatter ;
56use Code16 \Sharp \Show \Fields \Formatters \TextFormatter ;
67use Code16 \Sharp \Utils \Fields \IsSharpFieldWithEmbeds ;
78use Code16 \Sharp \Utils \Fields \IsSharpFieldWithLocalization ;
89use Code16 \Sharp \Utils \Fields \SharpFieldWithEmbeds ;
910use Code16 \Sharp \Utils \Fields \SharpFieldWithLocalization ;
11+ use Code16 \Sharp \Utils \Sanitization \IsSharpFieldWithHtmlSanitization ;
12+ use Code16 \Sharp \Utils \Sanitization \SharpFieldWithHtmlSanitization ;
1013
11- class SharpShowTextField extends SharpShowField implements IsSharpFieldWithEmbeds, IsSharpFieldWithLocalization
14+ class SharpShowTextField extends SharpShowField implements IsSharpFieldWithEmbeds, IsSharpFieldWithHtmlSanitization, IsSharpFieldWithLocalization
1215{
1316 use SharpFieldWithEmbeds;
17+ use SharpFieldWithHtmlSanitization;
1418 use SharpFieldWithLocalization;
1519
1620 const FIELD_TYPE = 'text ' ;
@@ -19,6 +23,12 @@ class SharpShowTextField extends SharpShowField implements IsSharpFieldWithEmbed
1923 protected ?int $ collapseToWordCount = null ;
2024 protected bool $ html = true ;
2125
26+ protected function __construct (string $ key , string $ type , ?SharpShowFieldFormatter $ formatter = null )
27+ {
28+ parent ::__construct ($ key , $ type , $ formatter );
29+ $ this ->sanitize = true ;
30+ }
31+
2232 public static function make (string $ key ): SharpShowTextField
2333 {
2434 return new static ($ key , static ::FIELD_TYPE , new TextFormatter ());
@@ -57,6 +67,7 @@ public function toArray(): array
5767 return parent ::buildArray ([
5868 'label ' => $ this ->label ,
5969 'html ' => $ this ->html ,
70+ 'sanitize ' => $ this ->sanitize ,
6071 'collapseToWordCount ' => $ this ->collapseToWordCount ,
6172 'localized ' => $ this ->localized ,
6273 'embeds ' => $ this ->innerComponentEmbedsConfiguration (false ) ?: null ,
0 commit comments