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 / CustomerLoyaltyRecommendationFormTemplate.php

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

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