From 0f283a16131288738d1b23a9d575451f64b98b42 Mon Sep 17 00:00:00 2001 From: Naomi Guyer Date: Thu, 11 Apr 2019 10:08:57 +1200 Subject: [PATCH] UI: supply element icon, replace type dropdown with radiobuttons --- src/Model/DecisionTreeStep.php | 7 +++++-- src/Model/ElementDecisionTree.php | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Model/DecisionTreeStep.php b/src/Model/DecisionTreeStep.php index 4c8a42f..5da57d3 100644 --- a/src/Model/DecisionTreeStep.php +++ b/src/Model/DecisionTreeStep.php @@ -9,6 +9,7 @@ use SilverStripe\Control\Controller; use SilverStripe\Forms\ReadOnlyField; use SilverStripe\Forms\GridField\GridField; +use SilverStripe\Forms\OptionsetField; use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor; use Symbiote\GridFieldExtensions\GridFieldOrderableRows; use UncleCheese\DisplayLogic\Forms\Wrapper as DisplayLogicWrapper; @@ -58,10 +59,12 @@ public function getCMSFields() $fields->removeByName('Answers'); + $fields->replaceField('Type', $type = OptionsetField::create('Type', 'Type' ,$this->dbObject('Type')->enumValues())); + // Allow to hide the title only on Result - $hideTitle = CheckboxField::create('HideTitle', 'HideTitle'); + $hideTitle = CheckboxField::create('HideTitle', 'Hide title'); $hideTitle->displayIf('Type')->isEqualTo('Result')->end(); - $fields->insertAfter($hideTitle, 'Title'); + $fields->insertAfter($hideTitle, 'Type'); if ($this->IsInDB()) { // Display Parent Answer diff --git a/src/Model/ElementDecisionTree.php b/src/Model/ElementDecisionTree.php index 7cbe5d3..afc9c6a 100644 --- a/src/Model/ElementDecisionTree.php +++ b/src/Model/ElementDecisionTree.php @@ -16,6 +16,8 @@ class ElementDecisionTree extends BaseElement private static $enable_title_in_template = true; + private static $icon = 'font-icon-flow-tree'; + private static $db = [ 'Introduction' => 'HTMLText' ];