File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ class DecisionTreeStep extends DataObject
2424 'getAnswerTreeForGrid ' => 'Answers '
2525 ];
2626
27+ private static $ default_result_title = 'Our recommendation ' ;
28+
2729 public function getCMSFields ()
2830 {
2931 $ fields = parent ::getCMSFields ();
@@ -65,6 +67,18 @@ public function getCMSFields()
6567 return $ fields ;
6668 }
6769
70+ /**
71+ * Set default title on Result steps
72+ */
73+ public function onBeforeWrite ()
74+ {
75+ if ($ this ->Type == 'Result ' && !$ this ->Title ) {
76+ $ this ->Title = $ this ->config ()->default_result_title ;
77+ }
78+
79+ parent ::onBeforeWrite ();
80+ }
81+
6882 /**
6983 * Prevent deleting Step with answers that have dependant questions
7084 */
Original file line number Diff line number Diff line change 1- <% if Step.Type == 'Question ' %>
1+ <% if $ Step.Type == 'Question ' %>
22<div class=" step<% if $FirstStep.ID == $Step.ID %> step--first<% end_if %>" >
33 <form action=" $Controller.Link('getNextStepForAnswer')" method=" post" class=" step-form" >
44 <% with $Step %>
55 <fieldset>
66 <legend class=" step-legend <% if $Content %>step-legend--withcontent<% end_if %>" >
7- <span class=" step-title" ><span class=" step-number" >$PositionInPathway.</span> $Title</span>
7+ <span class=" step-title" >
8+ <span class=" step-number" >$PositionInPathway.</span>
9+ <span class=" step-title-inner" >$Title</span>
10+ </span>
811 <% if $Content %><span class=" step-content" >$Content</span><% end_if %>
912 </legend>
1013 <% if Answers %>
2932<% else %>
3033<div class=" step step--result" aria-live=" polite" >
3134 <% with $Step %>
32- <% if not $HideTitle %><div class=" step-title" >$Title</div><% end_if %>
35+ <% if $Title && not $HideTitle %><div class=" step-title" >$Title</div><% end_if %>
3336 <div class=" step-content" >
3437 <% if $Content %>$Content<% end_if %>
3538 <button type=" button" class=" step-button" data-action=" restart-tree" data-target=" $Top.Controller.ParentController.Link" >Start again?</button>
You can’t perform that action at this time.
0 commit comments