From 6980d291286d4d0fe29b740be212fd7b1a3afa33 Mon Sep 17 00:00:00 2001 From: Matt Broadley Date: Mon, 23 May 2022 08:59:33 +0100 Subject: [PATCH] Added case for textarea to allow specific conditions to be set on this field type. Removed unnecessary breaks where we're returning. --- src/Column.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/Column.php b/src/Column.php index b62eb1a..730a55c 100644 --- a/src/Column.php +++ b/src/Column.php @@ -235,12 +235,10 @@ private function markupField(FormBuilder $formBuilder) case "ignore": // do not render this field at all return ''; - break; case "checkbox": return Field::checkbox($this->fieldNameWithBrackets, $this->options, $this->value, $this->asFormArray(Column::WITH_LABEL)); - break; case "checkboxes": @@ -255,7 +253,7 @@ private function markupField(FormBuilder $formBuilder) } return $output; - break; + case "checkboxes-readonly": /* Render text into the form and add hidden fields */ $attributes = $this->asFormArray(Column::WITH_LABEL); @@ -276,7 +274,6 @@ private function markupField(FormBuilder $formBuilder) $output .= '' . PHP_EOL; return $output; - break; case "select": @@ -298,12 +295,10 @@ private function markupField(FormBuilder $formBuilder) } return Form::select($fieldName, $this->options, $values, $attributes); - break; case "radios": return Form::{$this->type}($this->fieldNameWithBrackets, $this->options, $this->value, $this->asFormArray()); - break; case "option-table": // define table headers from first row @@ -346,7 +341,6 @@ private function markupField(FormBuilder $formBuilder) case "file": return Field::file($this->fieldNameWithBrackets, $this->asFormArray()); - break; case "date": @@ -377,7 +371,6 @@ private function markupField(FormBuilder $formBuilder) // We create date as a text field (NOT date!) because we replace it with a date picker and don't want Chrome to be "helpful" return Field::text($this->fieldNameWithBrackets, $this->value, $this->asFormArray()); - break; case "date-readonly": /* Render text into the form and add a hidden field */ @@ -398,7 +391,6 @@ private function markupField(FormBuilder $formBuilder) case "password": return Form::bsPassword($this->fieldNameWithBrackets, $this->value, $this->asFormArray()); - break; case "radios-readonly": /* Render text into the form and add a hidden field */ case "select-readonly": /* Render text into the form and add a hidden field */ @@ -495,12 +487,14 @@ private function markupField(FormBuilder $formBuilder) case "search": return Form::text($this->fieldNameWithBrackets, $this->value, $this->asFormArray()); - break; + + case 'textarea': + + return Field::{$this->type}($this->fieldNameWithBrackets, htmlspecialchars($this->value), $this->asFormArray()); default: return Field::{$this->type}($this->fieldNameWithBrackets, $this->value, $this->asFormArray()); - break; } return $output;