Skip to content

Commit

Permalink
Fix for field type
Browse files Browse the repository at this point in the history
  • Loading branch information
mediabeastnz committed Jan 26, 2017
1 parent 250a833 commit 3ecdc8e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions code/extensions/EditableCampaignMonitorField.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ public function getCMSFields()
"OptionsetField" => "OptionsetField",
"CheckboxSetField" => "CheckboxSetField",
"TextField" => "TextField",
"CheckboxField" => "CheckboxField"
))
->setEmptyString("Seelct a field type")
->setDescription("Default field type is Checkbox"),
->setEmptyString("Select a field type")
->setDescription("Default type is CheckboxField"),
), 'Type');

$editableColumns = new GridFieldEditableColumns();
Expand Down Expand Up @@ -127,9 +128,10 @@ public function getFormField()
// get default field type from config or from users selection
$fieldType = $this->config()->defaultFieldType;
// check if it's different to the default
if(isset($this->FieldType) && $this->FieldType != $fieldType) {
if(!empty($this->FieldType) && $this->FieldType != $fieldType) {
$fieldType = $this->FieldType;
}

// ensure format and data is correct based on type
if ($fieldType == 'DropdownField' || $fieldType == 'CheckboxSetField' || $fieldType == 'OptionsetField') {
$field = $fieldType::create($this->Name, $this->EscapedTitle, $this->getOptionsMap());
Expand Down

0 comments on commit 3ecdc8e

Please sign in to comment.