From e05846f4eea335323d54e6a2b17af1c5b7ac8ac3 Mon Sep 17 00:00:00 2001 From: Awilum Date: Sat, 29 Feb 2020 14:12:45 +0300 Subject: [PATCH] feat(form-plugin): add ability to work with string field for select2 --- site/plugins/form/app/Controllers/FormController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/site/plugins/form/app/Controllers/FormController.php b/site/plugins/form/app/Controllers/FormController.php index 54542bfd..5e9f7fb6 100644 --- a/site/plugins/form/app/Controllers/FormController.php +++ b/site/plugins/form/app/Controllers/FormController.php @@ -535,8 +535,10 @@ class FormController extends Controller $name = isset($properties['name']) ? $properties['name'] : $field_name; $current_value = isset($properties['value']) ? $properties['value'] : $field_value; - $current_value = array_map('trim', explode(',', $current_value)); - + if (! empty($current_value)) { + $current_value = array_map('trim', explode(',', $current_value)); + } + return $this->flextype['view']->fetch('plugins/form/templates/fields/tags/field.html', ['title' => $title, 'size' => $size, 'name' => $name, 'id' => $id, 'class' => $class, 'help' => $help , 'options' => $options, 'current_value' => $current_value]); }