PluginProbe
The Innovative Form Builder – IvyForms / 0.9
The Innovative Form Builder – IvyForms v0.9
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Services / Template / CustomerSupportFeedbackFormTemplate.php

CustomerSupportFeedbackFormTemplate.php in The Innovative Form Builder – IvyForms 0.9, at backend/src/Services/Template/CustomerSupportFeedbackFormTemplate.php

277 lines 9.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IvyForms\Services\Template;
4
5 // phpcs:disable PSR1.Files.SideEffects
6 if (!defined('ABSPATH')) {
7 exit; // Exit if accessed directly
8 }
9
10 use IvyForms\Services\Translations\BackendStrings;
11
12 class CustomerSupportFeedbackFormTemplate
13 {
14 /**
15 * Get the Customer Support Feedback template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'customer_support_feedback_form',
23 'name' => BackendStrings::getTemplateStrings()['customer_support_feedback_form'],
24 'description' => BackendStrings::getTemplateStrings()['customer_support_feedback_form_desc'],
25 'category' => 'feedback-forms',
26 'subcategory' => 'customer-feedback-forms',
27 'is_pro' => false,
28 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'customer-support-feedback-form.svg',
29 'form_data' => [
30 'name' => BackendStrings::getTemplateStrings()['customer_support_feedback_form'],
31 'published' => 1,
32 'showTitle' => 1,
33 'storeEntries' => 1,
34 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
35 'fields' => array_merge(
36 self::getIssueResolvedField(),
37 self::getAgentHelpfulnessRatingField(),
38 self::getResponseTimeRatingField(),
39 self::getImprovementsCheckboxField(),
40 self::getAdditionalCommentsTextareaField(),
41 self::getFollowUpEmailField()
42 ),
43 'settings' => []
44 ]
45 ];
46 }
47
48 /**
49 * Was your issue resolved? (radio, required)
50 *
51 * @return array<int, array<string, mixed>>
52 */
53 private static function getIssueResolvedField(): array
54 {
55 return [[
56 'id' => 4,
57 'fieldIndex' => 1,
58 'type' => 'radio',
59 'label' => BackendStrings::getTemplateStrings()['was_issue_resolved'],
60 'required' => true,
61 'parentId' => null,
62 'defaultValue' => '',
63 'placeholder' => '',
64 'position' => 1,
65 'fieldOptions' => [
66 [
67 'label' => BackendStrings::getTemplateStrings()['yes_fully'],
68 'value' => 'yes_fully',
69 'position' => 1,
70 ],
71 [
72 'label' => BackendStrings::getTemplateStrings()['partially'],
73 'value' => 'partially',
74 'position' => 2,
75 ],
76 [
77 'label' => BackendStrings::getComponentsStrings()['no'],
78 'value' => 'no',
79 'position' => 3,
80 ],
81 ]
82 ]];
83 }
84
85 /**
86 * Support agent helpfulness rating (required)
87 *
88 * @return array<int, array<string, mixed>>
89 */
90 private static function getAgentHelpfulnessRatingField(): array
91 {
92 return [[
93 'id' => 5,
94 'fieldIndex' => 2,
95 'type' => 'rating',
96 'label' => BackendStrings::getTemplateStrings()['support_agent_helpfulness'],
97 'required' => true,
98 'defaultValue' => '',
99 'placeholder' => '',
100 'position' => 2,
101 'labelPosition' => 'default',
102 'ratingIcon' => 'star',
103 'fieldOptions' => self::getStandardRatingOptions(1),
104 'showValues' => false,
105 'showRatingText' => true,
106 ]];
107 }
108
109 /**
110 * Response time rating (required)
111 *
112 * @return array<int, array<string, mixed>>
113 */
114 private static function getResponseTimeRatingField(): array
115 {
116 return [[
117 'id' => 6,
118 'fieldIndex' => 3,
119 'type' => 'rating',
120 'label' => BackendStrings::getTemplateStrings()['response_time'],
121 'required' => true,
122 'defaultValue' => '',
123 'placeholder' => '',
124 'position' => 3,
125 'labelPosition' => 'default',
126 'ratingIcon' => 'star',
127 'fieldOptions' => self::getStandardRatingOptions(6),
128 'showValues' => false,
129 'showRatingText' => true,
130 ]];
131 }
132
133 /**
134 * What could be improved? (checkbox, optional)
135 *
136 * @return array<int, array<string, mixed>>
137 */
138 private static function getImprovementsCheckboxField(): array
139 {
140 return [[
141 'id' => 12,
142 'fieldIndex' => 4,
143 'type' => 'checkbox',
144 'label' => BackendStrings::getTemplateStrings()['what_could_be_improved'],
145 'required' => false,
146 'parentId' => null,
147 'defaultValue' => '',
148 'placeholder' => '',
149 'position' => 4,
150 'fieldOptions' => [
151 [
152 'id' => 7,
153 'label' => BackendStrings::getTemplateStrings()['faster_response'],
154 'value' => 'faster_response',
155 'isDefault' => false,
156 'position' => 1,
157 ],
158 [
159 'id' => 8,
160 'label' => BackendStrings::getTemplateStrings()['clearer_communication'],
161 'value' => 'clearer_communication',
162 'isDefault' => false,
163 'position' => 2,
164 ],
165 [
166 'id' => 9,
167 'label' => BackendStrings::getTemplateStrings()['better_problem_resolution'],
168 'value' => 'better_problem_resolution',
169 'isDefault' => false,
170 'position' => 3,
171 ],
172 [
173 'id' => 10,
174 'label' => BackendStrings::getTemplateStrings()['friendliness'],
175 'value' => 'friendliness',
176 'isDefault' => false,
177 'position' => 4,
178 ],
179 [
180 'id' => 11,
181 'label' => BackendStrings::getTemplateStrings()['no_improvements_needed'],
182 'value' => 'no_improvements_needed',
183 'isDefault' => false,
184 'position' => 5,
185 ],
186 ]
187 ]];
188 }
189
190 /**
191 * Additional comments (textarea, optional)
192 *
193 * @return array<int, array<string, mixed>>
194 */
195 private static function getAdditionalCommentsTextareaField(): array
196 {
197 return [[
198 'id' => 13,
199 'fieldIndex' => 5,
200 'type' => 'textarea',
201 'label' => BackendStrings::getTemplateStrings()['additional_comments'],
202 'placeholder' => BackendStrings::getTemplateStrings()['additional_comments_placeholder'],
203 'required' => false,
204 'parentId' => null,
205 'defaultValue' => '',
206 'position' => 5,
207 'labelPosition' => 'default',
208 ]];
209 }
210
211 /**
212 * Follow-up email (email, optional)
213 *
214 * @return array<int, array<string, mixed>>
215 */
216 private static function getFollowUpEmailField(): array
217 {
218 return [[
219 'id' => 14,
220 'fieldIndex' => 6,
221 'type' => 'email',
222 'label' => BackendStrings::getTemplateStrings()['follow_up_email'],
223 'placeholder' => BackendStrings::getTemplateStrings()['follow_up_email_placeholder'],
224 'required' => false,
225 'parentId' => null,
226 'defaultValue' => '',
227 'position' => 6,
228 ]];
229 }
230
231 /**
232 * Standard rating options (1-5)
233 *
234 * @return array<int, array<string, mixed>>
235 */
236 private static function getStandardRatingOptions(int $startId): array
237 {
238 return [
239 [
240 'id' => $startId,
241 'label' => BackendStrings::getNewFormStrings()['good'],
242 'value' => '1',
243 'isDefault' => false,
244 'position' => 1
245 ],
246 [
247 'id' => $startId + 1,
248 'label' => BackendStrings::getNewFormStrings()['nice'],
249 'value' => '2',
250 'isDefault' => false,
251 'position' => 2
252 ],
253 [
254 'id' => $startId + 2,
255 'label' => BackendStrings::getNewFormStrings()['very_good'],
256 'value' => '3',
257 'isDefault' => false,
258 'position' => 3
259 ],
260 [
261 'id' => $startId + 3,
262 'label' => BackendStrings::getNewFormStrings()['awesome'],
263 'value' => '4',
264 'isDefault' => false,
265 'position' => 4
266 ],
267 [
268 'id' => $startId + 4,
269 'label' => BackendStrings::getNewFormStrings()['amazing'],
270 'value' => '5',
271 'isDefault' => false,
272 'position' => 5
273 ],
274 ];
275 }
276 }
277