File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -427,8 +427,10 @@ private function markupField(FormBuilder $formBuilder)
427427
428428 case "text-readonly " : /* Render text into the form and add a hidden field */
429429 case "number-readonly " :
430- case "textarea-readonly " : /* Render text into the form and add a hidden field */
431430 $ this ->value = OutputHelper::output ($ this ->value );
431+ case "textarea-readonly " : /* Render text into the form and add a hidden field */
432+ $ this ->value = $ this ->stripTagsTextarea ();
433+
432434 if (!empty ($ this ->value ) || $ this ->value === 0 ) {
433435 $ output .= '<div class=" ' . $ this ->classBundle . '"> ' ;
434436 $ output .= '<div class="section-readonly"> ' ;
@@ -489,6 +491,7 @@ private function markupField(FormBuilder $formBuilder)
489491 return Form::text ($ this ->fieldNameWithBrackets , $ this ->value , $ this ->asFormArray ());
490492
491493 case 'textarea ' :
494+ $ this ->value = $ this ->stripTagsTextarea ();
492495
493496 return Field::{$ this ->type }($ this ->fieldNameWithBrackets , htmlspecialchars ($ this ->value ), $ this ->asFormArray ());
494497
@@ -731,4 +734,25 @@ private function parseDefaultValue(FormBuilder $formBuilder)
731734
732735 return $ this ->default_value ;
733736 }
737+
738+ /**
739+ * @return string
740+ */
741+ protected function stripTagsTextarea (): string
742+ {
743+ return strip_tags ($ this ->value , [
744+ 'p ' ,
745+ 'strong ' ,
746+ 'em ' ,
747+ 'b ' ,
748+ 'i ' ,
749+ 'ol ' ,
750+ 'ul ' ,
751+ 'li ' ,
752+ 'br ' ,
753+ 'span ' ,
754+ 'div ' ,
755+ 'wbr '
756+ ]);
757+ }
734758}
You can’t perform that action at this time.
0 commit comments