diff --git a/site/plugins/form/app/Controllers/FormController.php b/site/plugins/form/app/Controllers/FormController.php index 1140b04e..2cd6b928 100644 --- a/site/plugins/form/app/Controllers/FormController.php +++ b/site/plugins/form/app/Controllers/FormController.php @@ -477,18 +477,12 @@ class FormController extends Controller $title = isset($properties['title']) ? $properties['title'] : ''; $size = isset($properties['size']) ? $this->sizes[$properties['size']] : $this->sizes['12']; $help = isset($properties['help']) ? $properties['help'] : ''; + $value = isset($properties['value']) ? $properties['value'] : $field_value; + $id = isset($properties['id']) ? $properties['id'] : $field_id; + $name = isset($properties['name']) ? $properties['name'] : $field_name; + $class = isset($properties['class']) ? $properties['class'] : $this->field_class; - $attributes = isset($properties['attributes']) ? $properties['attributes'] : []; - $attributes['id'] = isset($attributes['id']) ? $attributes['id'] : $field_id; - $attributes['class'] = isset($attributes['class']) ? $attributes['class'] : $this->field_class; - - $field = '
'; - $field .= ($title ? Form::label($field_id, __($title)) : ''); - $field .= Form::textarea($field_name, $field_value, $attributes); - $field .= ($help ? '' . __($help) . '' : ''); - $field .= '
'; - - return $field; + return $this->flextype['view']->fetch('plugins/form/templates/fields/textarea/field.html', ['title' => $title, 'size' => $size, 'name' => $name, 'id' => $id, 'class' => $class, 'help' => $help , 'value' => $value]); } /** @@ -537,12 +531,12 @@ class FormController extends Controller */ protected function textField(string $field_id, string $field_name, $field_value, array $properties) : string { - $title = isset($properties['title']) ? $properties['title'] : ''; - $size = isset($properties['size']) ? $this->sizes[$properties['size']] : $this->sizes['12']; - $help = isset($properties['help']) ? $properties['help'] : ''; - $id = isset($properties['id']) ? $properties['id'] : $field_id; - $name = isset($properties['name']) ? $properties['name'] : $field_name; - $class = isset($properties['class']) ? $properties['class'] : $this->field_class; + $title = isset($properties['title']) ? $properties['title'] : ''; + $size = isset($properties['size']) ? $this->sizes[$properties['size']] : $this->sizes['12']; + $help = isset($properties['help']) ? $properties['help'] : ''; + $id = isset($properties['id']) ? $properties['id'] : $field_id; + $name = isset($properties['name']) ? $properties['name'] : $field_name; + $class = isset($properties['class']) ? $properties['class'] : $this->field_class; $value = isset($properties['value']) ? $properties['value'] : $field_value; return $this->flextype['view']->fetch('plugins/form/templates/fields/text/field.html', ['title' => $title, 'size' => $size, 'name' => $name, 'id' => $id, 'class' => $class, 'help' => $help, 'value' => $value]); diff --git a/site/plugins/form/templates/fields/textarea/field.html b/site/plugins/form/templates/fields/textarea/field.html new file mode 100644 index 00000000..15c93d88 --- /dev/null +++ b/site/plugins/form/templates/fields/textarea/field.html @@ -0,0 +1,7 @@ +
+ + + {% if help %} + {{ help }} + {% endif %} +
\ No newline at end of file