From 940e860c01fb966796ba4d8f3a25dcf6895c9535 Mon Sep 17 00:00:00 2001 From: Mark Taylor Date: Mon, 9 Oct 2023 15:02:30 +1100 Subject: [PATCH 1/2] Add templates --- src/editableformfields/EditableDependentDynamicListField.php | 4 ++-- src/editableformfields/EditableDynamicListField.php | 4 ++-- .../DynamicLists/EditableDependentDynamicListField.ss | 1 + templates/Symbiote/DynamicLists/EditableDynamicListField.ss | 1 + templates/Symbiote/DynamicLists/EditableFormField_holder.ss | 1 + 5 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 templates/Symbiote/DynamicLists/EditableDependentDynamicListField.ss create mode 100644 templates/Symbiote/DynamicLists/EditableDynamicListField.ss create mode 100644 templates/Symbiote/DynamicLists/EditableFormField_holder.ss diff --git a/src/editableformfields/EditableDependentDynamicListField.php b/src/editableformfields/EditableDependentDynamicListField.php index abd8347..46368f2 100644 --- a/src/editableformfields/EditableDependentDynamicListField.php +++ b/src/editableformfields/EditableDependentDynamicListField.php @@ -120,8 +120,8 @@ public function getFormField() $field = DropdownField::create($this->Name, $this->Title, array()); } $field - ->setFieldHolderTemplate('UserFormsField_holder') - ->setTemplate('UserFormsDropdownField'); + ->setFieldHolderTemplate(EditableFormField::class . '_holder') + ->setTemplate(__CLASS__); $this->doUpdateFormField($field); return $field; } diff --git a/src/editableformfields/EditableDynamicListField.php b/src/editableformfields/EditableDynamicListField.php index c0c9c01..b6b346f 100644 --- a/src/editableformfields/EditableDynamicListField.php +++ b/src/editableformfields/EditableDynamicListField.php @@ -82,8 +82,8 @@ public function getCMSFields() public function getFormField() { $field = DynamicListField::create($this->Name, $this->Title, $this->ListTitle) - ->setFieldHolderTemplate('UserFormsField_holder') - ->setTemplate('UserFormsDropdownField'); + ->setFieldHolderTemplate(EditableFormField::class . '_holder') + ->setTemplate(__CLASS__); if ($this->UseEmptyString) { $field->setEmptyString(($this->EmptyString) ? $this->EmptyString : ''); } diff --git a/templates/Symbiote/DynamicLists/EditableDependentDynamicListField.ss b/templates/Symbiote/DynamicLists/EditableDependentDynamicListField.ss new file mode 100644 index 0000000..2570635 --- /dev/null +++ b/templates/Symbiote/DynamicLists/EditableDependentDynamicListField.ss @@ -0,0 +1 @@ +<% include SilverStripe/UserForms/Model/EditableFormField/EditableDropdown %> diff --git a/templates/Symbiote/DynamicLists/EditableDynamicListField.ss b/templates/Symbiote/DynamicLists/EditableDynamicListField.ss new file mode 100644 index 0000000..2570635 --- /dev/null +++ b/templates/Symbiote/DynamicLists/EditableDynamicListField.ss @@ -0,0 +1 @@ +<% include SilverStripe/UserForms/Model/EditableFormField/EditableDropdown %> diff --git a/templates/Symbiote/DynamicLists/EditableFormField_holder.ss b/templates/Symbiote/DynamicLists/EditableFormField_holder.ss new file mode 100644 index 0000000..c64c4b5 --- /dev/null +++ b/templates/Symbiote/DynamicLists/EditableFormField_holder.ss @@ -0,0 +1 @@ +<% include SilverStripe/UserForms/Model/EditableFormField_holder %> From ca62b257458a50578c9348a5a28c2ea24aeb5068 Mon Sep 17 00:00:00 2001 From: Mark Taylor Date: Mon, 9 Oct 2023 15:02:49 +1100 Subject: [PATCH 2/2] Remove extra dropdown css class --- src/fields/DynamicListField.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/fields/DynamicListField.php b/src/fields/DynamicListField.php index 226282b..53dcb16 100644 --- a/src/fields/DynamicListField.php +++ b/src/fields/DynamicListField.php @@ -32,8 +32,6 @@ public function __construct($name, $title = null, $source = null, $value = "", $ } } - $this->addExtraClass('dropdown'); - parent::__construct($name, $title, $source, $value, $form, $emptyString); } }