PluginProbe
The Innovative Form Builder – IvyForms / 1.1.1
The Innovative Form Builder – IvyForms v1.1.1
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 / CustomerLoyaltyRecommendationFormTemplate.php

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

324 lines 10.6 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 use IvyForms\Services\Translations\BackendStrings;
6
7 class CustomerLoyaltyRecommendationFormTemplate
8 {
9 /**
10 * Get template metadata (without form_data)
11 *
12 * @return array<string, mixed>
13 */
14 public static function getTemplateMeta(): array
15 {
16 return [
17 'id' => 'customer_loyalty_recommendation_form',
18 'name' => BackendStrings::getTemplateStrings()['customer_loyalty_recommendation_form'],
19 'description' => BackendStrings::getTemplateStrings()['customer_loyalty_recommendation_form_desc'],
20 'category' => 'feedback-forms',
21 'subcategory' => 'customer-feedback-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'customer-loyalty-recommendation-form.svg',
24 ];
25 }
26
27 /**
28 * Get the full template including form data
29 *
30 * @return array<string, mixed>
31 */
32 public static function getTemplate(): array
33 {
34 return array_merge(
35 self::getTemplateMeta(),
36 [
37 'form_data' => [
38 'name' => BackendStrings::getTemplateStrings()['customer_loyalty_recommendation_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getUsageFrequencyField(),
45 self::getOverallSatisfactionRatingField(),
46 self::getRecommendationLikelihoodField(),
47 self::getWhatKeepsYouComingBackField(),
48 self::getWhatCouldMakeMoreLoyalTextareaField(),
49 self::getEmailField()
50 ),
51 'settings' => []
52 ]
53 ]
54 );
55 }
56
57 /**
58 * How often do you use our product/service? (radio)
59 *
60 * @return array<int, array<string, mixed>>
61 */
62 private static function getUsageFrequencyField(): array
63 {
64 return [[
65 'id' => 5,
66 'fieldIndex' => 1,
67 'type' => 'radio',
68 'label' => BackendStrings::getTemplateStrings()['how_often_use_product_service'],
69 'required' => true,
70 'parentId' => null,
71 'defaultValue' => '',
72 'placeholder' => '',
73 'position' => 1,
74 'fieldOptions' => [
75 [
76 'label' => BackendStrings::getTemplateStrings()['usage_first_time'],
77 'value' => 'first_time',
78 'position' => 1,
79 ],
80 [
81 'label' => BackendStrings::getTemplateStrings()['usage_occasionally'],
82 'value' => 'occasionally',
83 'position' => 2,
84 ],
85 [
86 'label' => BackendStrings::getTemplateStrings()['usage_regularly'],
87 'value' => 'regularly',
88 'position' => 3,
89 ],
90 [
91 'label' => BackendStrings::getTemplateStrings()['usage_long_term_customer'],
92 'value' => 'long_term',
93 'position' => 4,
94 ],
95 ]
96 ]];
97 }
98
99 /**
100 * Overall satisfaction rating
101 *
102 * @return array<int, array<string, mixed>>
103 */
104 private static function getOverallSatisfactionRatingField(): array
105 {
106 return [[
107 'id' => 6,
108 'fieldIndex' => 2,
109 'type' => 'rating',
110 'label' => BackendStrings::getTemplateStrings()['overall_satisfaction'],
111 'required' => true,
112 'defaultValue' => '',
113 'placeholder' => '',
114 'position' => 2,
115 'labelPosition' => 'default',
116 'ratingIcon' => 'star',
117 'fieldOptions' => self::getStandardRatingOptions(1),
118 'showValues' => false,
119 'showRatingText' => true,
120 ]];
121 }
122
123 /**
124 * How likely are you to recommend us? (rating)
125 *
126 * @return array<int, array<string, mixed>>
127 */
128 private static function getRecommendationLikelihoodField(): array
129 {
130 return [[
131 'id' => 12,
132 'fieldIndex' => 3,
133 'type' => 'rating',
134 'label' => BackendStrings::getTemplateStrings()['how_likely_recommend_us'],
135 'required' => true,
136 'parentId' => null,
137 'defaultValue' => '',
138 'placeholder' => '',
139 'position' => 3,
140 'labelPosition' => 'default',
141 'ratingIcon' => 'star',
142 'fieldOptions' => [
143 [
144 'id' => 7,
145 'label' => BackendStrings::getTemplateStrings()['recommendation_very_likely'],
146 'value' => '5',
147 'isDefault' => false,
148 'position' => 1,
149 ],
150 [
151 'id' => 8,
152 'label' => BackendStrings::getTemplateStrings()['recommendation_likely'],
153 'value' => '4',
154 'isDefault' => false,
155 'position' => 2,
156 ],
157 [
158 'id' => 9,
159 'label' => BackendStrings::getTemplateStrings()['recommendation_not_sure'],
160 'value' => '3',
161 'isDefault' => false,
162 'position' => 3,
163 ],
164 [
165 'id' => 10,
166 'label' => BackendStrings::getTemplateStrings()['recommendation_unlikely'],
167 'value' => '2',
168 'isDefault' => false,
169 'position' => 4,
170 ],
171 [
172 'id' => 11,
173 'label' => BackendStrings::getTemplateStrings()['recommendation_very_unlikely'],
174 'value' => '1',
175 'isDefault' => false,
176 'position' => 5,
177 ],
178 ],
179 'showValues' => false,
180 'showRatingText' => true,
181 ]];
182 }
183
184 /**
185 * What keeps you coming back? (checkbox)
186 *
187 * @return array<int, array<string, mixed>>
188 */
189 private static function getWhatKeepsYouComingBackField(): array
190 {
191 return [[
192 'id' => 18,
193 'fieldIndex' => 4,
194 'type' => 'checkbox',
195 'label' => BackendStrings::getTemplateStrings()['what_keeps_you_coming_back'],
196 'required' => false,
197 'parentId' => null,
198 'defaultValue' => '',
199 'placeholder' => '',
200 'position' => 4,
201 'fieldOptions' => [
202 [
203 'id' => 13,
204 'label' => BackendStrings::getTemplateStrings()['keeps_product_quality'],
205 'value' => 'product_quality',
206 'position' => 1,
207 ],
208 [
209 'id' => 14,
210 'label' => BackendStrings::getTemplateStrings()['keeps_pricing'],
211 'value' => 'pricing',
212 'position' => 2,
213 ],
214 [
215 'id' => 15,
216 'label' => BackendStrings::getTemplateStrings()['keeps_customer_support'],
217 'value' => 'customer_support',
218 'position' => 3,
219 ],
220 [
221 'id' => 16,
222 'label' => BackendStrings::getTemplateStrings()['keeps_ease_of_use'],
223 'value' => 'ease_of_use',
224 'position' => 4,
225 ],
226 [
227 'id' => 17,
228 'label' => BackendStrings::getTemplateStrings()['keeps_trust_in_brand'],
229 'value' => 'trust_in_brand',
230 'position' => 5,
231 ],
232 ]
233 ]];
234 }
235
236 /**
237 * What could make you more loyal? (textarea)
238 *
239 * @return array<int, array<string, mixed>>
240 */
241 private static function getWhatCouldMakeMoreLoyalTextareaField(): array
242 {
243 return [[
244 'id' => 19,
245 'fieldIndex' => 5,
246 'type' => 'textarea',
247 'label' => BackendStrings::getTemplateStrings()['what_could_make_you_more_loyal'],
248 'placeholder' => BackendStrings::getTemplateStrings()['what_could_make_you_more_loyal_placeholder'],
249 'required' => false,
250 'parentId' => null,
251 'defaultValue' => '',
252 'position' => 5,
253 'labelPosition' => 'default',
254 ]];
255 }
256
257 /**
258 * Email field
259 *
260 * @return array<int, array<string, mixed>>
261 */
262 private static function getEmailField(): array
263 {
264 return [[
265 'id' => 20,
266 'fieldIndex' => 6,
267 'type' => 'email',
268 'label' => BackendStrings::getTemplateStrings()['email_address'],
269 'placeholder' => '[email protected]',
270 'required' => false,
271 'parentId' => null,
272 'defaultValue' => '',
273 'position' => 6,
274 'description' => BackendStrings::getTemplateStrings()['follow_up_email_description'],
275 ]];
276 }
277
278 /**
279 * Standard rating options (1-5)
280 *
281 * @return array<int, array<string, mixed>>
282 */
283 private static function getStandardRatingOptions(int $startId): array
284 {
285 return [
286 [
287 'id' => $startId,
288 'label' => BackendStrings::getNewFormStrings()['good'],
289 'value' => '1',
290 'isDefault' => false,
291 'position' => 1,
292 ],
293 [
294 'id' => $startId + 1,
295 'label' => BackendStrings::getNewFormStrings()['nice'],
296 'value' => '2',
297 'isDefault' => false,
298 'position' => 2,
299 ],
300 [
301 'id' => $startId + 2,
302 'label' => BackendStrings::getNewFormStrings()['very_good'],
303 'value' => '3',
304 'isDefault' => false,
305 'position' => 3,
306 ],
307 [
308 'id' => $startId + 3,
309 'label' => BackendStrings::getNewFormStrings()['awesome'],
310 'value' => '4',
311 'isDefault' => false,
312 'position' => 4,
313 ],
314 [
315 'id' => $startId + 4,
316 'label' => BackendStrings::getNewFormStrings()['amazing'],
317 'value' => '5',
318 'isDefault' => false,
319 'position' => 5,
320 ],
321 ];
322 }
323 }
324