PluginProbe
The Innovative Form Builder – IvyForms / 1.0
The Innovative Form Builder – IvyForms v1.0
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 / ProductFeedbackFormTemplate.php

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

293 lines 10.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace IvyForms\Services\Template;
6
7 use IvyForms\Services\Translations\BackendStrings;
8
9 /**
10 * Product Feedback Form Template
11 *
12 * Collect feedback about a specific product to improve quality, features, and usability.
13 */
14 class ProductFeedbackFormTemplate
15 {
16 /**
17 * Get the Product Feedback Form template
18 *
19 * @return array<string, mixed>
20 */
21 public static function getTemplate(): array
22 {
23 return [
24 'id' => 'product_feedback_form',
25 'name' => BackendStrings::getTemplateStrings()['product_feedback_form'],
26 'description' => BackendStrings::getTemplateStrings()['product_feedback_form_desc'],
27 'category' => 'feedback-forms',
28 'subcategory' => 'customer-feedback-forms',
29 'is_pro' => false,
30 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'product-feedback-form.svg',
31 'form_data' => [
32 'name' => BackendStrings::getTemplateStrings()['product_feedback_form'],
33 'published' => 1,
34 'showTitle' => 1,
35 'storeEntries' => 1,
36 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
37 'fields' => array_merge(
38 self::getProductNameField(),
39 self::getIssuesExperiencedCheckboxField(),
40 self::getProductQualityRatingField(),
41 self::getValueForMoneyRatingField(),
42 self::getWhatDidYouLikeMostTextareaField(),
43 self::getWhatCanBeImprovedTextareaField()
44 ),
45 'settings' => []
46 ]
47 ];
48 }
49
50 /**
51 * Product name dropdown (required)
52 *
53 * @return array<int, array<string, mixed>>
54 */
55 private static function getProductNameField(): array
56 {
57 return [[
58 'id' => 5,
59 'fieldIndex' => 1,
60 'type' => 'select',
61 'label' => BackendStrings::getTemplateStrings()['product_name'],
62 'required' => true,
63 'parentId' => null,
64 'defaultValue' => '',
65 'placeholder' => BackendStrings::getTemplateStrings()['product_name_placeholder'],
66 'position' => 1,
67 'fieldOptions' => [
68 [
69 'id' => 1,
70 'label' => BackendStrings::getTemplateStrings()['product_a'],
71 'value' => 'product_a',
72 'isDefault' => false,
73 'position' => 1,
74 ],
75 [
76 'id' => 2,
77 'label' => BackendStrings::getTemplateStrings()['product_b'],
78 'value' => 'product_b',
79 'isDefault' => false,
80 'position' => 2,
81 ],
82 [
83 'id' => 3,
84 'label' => BackendStrings::getTemplateStrings()['product_c'],
85 'value' => 'product_c',
86 'isDefault' => false,
87 'position' => 3,
88 ],
89 [
90 'id' => 4,
91 'label' => BackendStrings::getTemplateStrings()['other'],
92 'value' => 'other',
93 'isDefault' => false,
94 'position' => 4,
95 ],
96 ]
97 ]];
98 }
99
100 /**
101 * Issues experienced checkbox (optional)
102 *
103 * @return array<int, array<string, mixed>>
104 */
105 private static function getIssuesExperiencedCheckboxField(): array
106 {
107 return [[
108 'id' => 11,
109 'fieldIndex' => 2,
110 'type' => 'checkbox',
111 'label' => BackendStrings::getTemplateStrings()['issues_experienced'],
112 'required' => false,
113 'parentId' => null,
114 'defaultValue' => '',
115 'placeholder' => '',
116 'position' => 2,
117 'fieldOptions' => [
118 [
119 'id' => 6,
120 'label' => BackendStrings::getNewFormStrings()['difficult_to_use'],
121 'value' => 'difficult_to_use',
122 'isDefault' => false,
123 'position' => 1,
124 ],
125 [
126 'id' => 7,
127 'label' => BackendStrings::getTemplateStrings()['missing_features'],
128 'value' => 'missing_features',
129 'isDefault' => false,
130 'position' => 2,
131 ],
132 [
133 'id' => 8,
134 'label' => BackendStrings::getTemplateStrings()['performance_issues'],
135 'value' => 'performance_issues',
136 'isDefault' => false,
137 'position' => 3,
138 ],
139 [
140 'id' => 9,
141 'label' => BackendStrings::getTemplateStrings()['quality_concerns'],
142 'value' => 'quality_concerns',
143 'isDefault' => false,
144 'position' => 4,
145 ],
146 [
147 'id' => 10,
148 'label' => BackendStrings::getTemplateStrings()['no_issues'],
149 'value' => 'no_issues',
150 'isDefault' => false,
151 'position' => 5,
152 ],
153 ]
154 ]];
155 }
156
157 /**
158 * Product quality rating (required)
159 *
160 * @return array<int, array<string, mixed>>
161 */
162 private static function getProductQualityRatingField(): array
163 {
164 return [[
165 'id' => 12,
166 'fieldIndex' => 3,
167 'type' => 'rating',
168 'label' => BackendStrings::getTemplateStrings()['product_quality'],
169 'required' => true,
170 'defaultValue' => '',
171 'placeholder' => '',
172 'position' => 3,
173 'labelPosition' => 'default',
174 'ratingIcon' => 'star',
175 'fieldOptions' => self::getStandardRatingOptions(5),
176 'showValues' => false,
177 'showRatingText' => true,
178 ]];
179 }
180
181 /**
182 * Value for money rating (required)
183 *
184 * @return array<int, array<string, mixed>>
185 */
186 private static function getValueForMoneyRatingField(): array
187 {
188 return [[
189 'id' => 13,
190 'fieldIndex' => 4,
191 'type' => 'rating',
192 'label' => BackendStrings::getTemplateStrings()['value_for_money'],
193 'required' => true,
194 'defaultValue' => '',
195 'placeholder' => '',
196 'position' => 4,
197 'labelPosition' => 'default',
198 'ratingIcon' => 'star',
199 'fieldOptions' => self::getStandardRatingOptions(10),
200 'showValues' => false,
201 'showRatingText' => true,
202 ]];
203 }
204
205 /**
206 * What did you like the most textarea (optional)
207 *
208 * @return array<int, array<string, mixed>>
209 */
210 private static function getWhatDidYouLikeMostTextareaField(): array
211 {
212 return [[
213 'id' => 14,
214 'fieldIndex' => 5,
215 'type' => 'textarea',
216 'label' => BackendStrings::getTemplateStrings()['what_did_you_like_most'],
217 'placeholder' => BackendStrings::getTemplateStrings()['what_did_you_like_most_placeholder'],
218 'required' => false,
219 'parentId' => null,
220 'defaultValue' => '',
221 'position' => 5,
222 'labelPosition' => 'default',
223 ]];
224 }
225
226 /**
227 * What can be improved textarea (optional)
228 *
229 * @return array<int, array<string, mixed>>
230 */
231 private static function getWhatCanBeImprovedTextareaField(): array
232 {
233 return [[
234 'id' => 15,
235 'fieldIndex' => 6,
236 'type' => 'textarea',
237 'label' => BackendStrings::getTemplateStrings()['what_can_be_improved'],
238 'placeholder' => BackendStrings::getTemplateStrings()['what_can_be_improved_placeholder'],
239 'required' => false,
240 'parentId' => null,
241 'defaultValue' => '',
242 'position' => 6,
243 'labelPosition' => 'default',
244 ]];
245 }
246
247 /**
248 * Standard rating options (1-5)
249 *
250 * @return array<int, array<string, mixed>>
251 */
252 private static function getStandardRatingOptions(int $startId): array
253 {
254 return [
255 [
256 'id' => $startId,
257 'label' => BackendStrings::getNewFormStrings()['good'],
258 'value' => '1',
259 'isDefault' => false,
260 'position' => 1
261 ],
262 [
263 'id' => $startId + 1,
264 'label' => BackendStrings::getNewFormStrings()['nice'],
265 'value' => '2',
266 'isDefault' => false,
267 'position' => 2
268 ],
269 [
270 'id' => $startId + 2,
271 'label' => BackendStrings::getNewFormStrings()['very_good'],
272 'value' => '3',
273 'isDefault' => false,
274 'position' => 3
275 ],
276 [
277 'id' => $startId + 3,
278 'label' => BackendStrings::getNewFormStrings()['awesome'],
279 'value' => '4',
280 'isDefault' => false,
281 'position' => 4
282 ],
283 [
284 'id' => $startId + 4,
285 'label' => BackendStrings::getNewFormStrings()['amazing'],
286 'value' => '5',
287 'isDefault' => false,
288 'position' => 5
289 ],
290 ];
291 }
292 }
293