PluginProbe
The Innovative Form Builder – IvyForms / 0.8.2
The Innovative Form Builder – IvyForms v0.8.2
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 / WeddingCakeOrderFormTemplate.php

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

490 lines 16.9 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 WeddingCakeOrderFormTemplate
13 {
14 /**
15 * Get the wedding cake order form template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'wedding_cake_order_form',
23 'name' => BackendStrings::getTemplateStrings()['wedding_cake_order_form'],
24 'description' => BackendStrings::getTemplateStrings()['wedding_cake_order_form_desc'],
25 'category' => 'order-forms',
26 'subcategory' => 'cake-order-forms',
27 'is_pro' => false,
28 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'wedding-cake-order-form.svg',
29 'form_data' => [
30 'name' => BackendStrings::getTemplateStrings()['wedding_cake_order_form'],
31 'published' => 1,
32 'showTitle' => 1,
33 'storeEntries' => 1,
34 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
35 'fields' => array_merge(
36 self::getCustomerInformationFields(),
37 self::getCakeDetailsFields(),
38 self::getDeliveryDetailsFields()
39 ),
40 'settings' => []
41 ]
42 ];
43 }
44
45 /**
46 * Get customer information fields
47 *
48 * @return array<int, array<string, mixed>>
49 */
50 private static function getCustomerInformationFields(): array
51 {
52 return [
53 // Bride & Groom Names - Parent
54 [
55 'id' => 0,
56 'fieldIndex' => 1,
57 'type' => 'name',
58 'label' => BackendStrings::getTemplateStrings()['bride_groom_names'],
59 'parentId' => null,
60 'defaultValue' => '',
61 'placeholder' => '',
62 'required' => true,
63 'readonly' => false,
64 'position' => 1,
65 ],
66 // First Name - Child of Name Field
67 [
68 'id' => 0,
69 'type' => 'text',
70 'label' => BackendStrings::getNewFormStrings()['first_name'],
71 'placeholder' => BackendStrings::getTemplateStrings()['enter_couple_names'],
72 'required' => true,
73 'parentId' => 0,
74 'fieldIndex' => 1,
75 'defaultValue' => '',
76 'position' => 1,
77 'optionHide' => false,
78 'description' => '',
79 'settings' => json_encode(['nameFieldType' => 'nameField1']),
80 ],
81 // Last Name - Child of Name Field
82 [
83 'id' => 0,
84 'type' => 'text',
85 'label' => BackendStrings::getNewFormStrings()['last_name'],
86 'placeholder' => BackendStrings::getTemplateStrings()['enter_couple_lastnames'],
87 'required' => true,
88 'parentId' => 0,
89 'fieldIndex' => 1,
90 'defaultValue' => '',
91 'position' => 2,
92 'optionHide' => false,
93 'description' => '',
94 'settings' => json_encode(['nameFieldType' => 'nameField2']),
95 ],
96 // Email Address
97 [
98 'id' => 0,
99 'fieldIndex' => 2,
100 'type' => 'email',
101 'label' => BackendStrings::getTemplateStrings()['email_address'],
102 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_email'],
103 'required' => true,
104 'parentId' => null,
105 'defaultValue' => '',
106 'position' => 2,
107 ],
108 // Phone Number
109 [
110 'id' => 0,
111 'fieldIndex' => 3,
112 'type' => 'phone',
113 'label' => BackendStrings::getTemplateStrings()['phone_number'],
114 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_phone_number'],
115 'required' => true,
116 'parentId' => null,
117 'defaultValue' => '',
118 'position' => 3,
119 'phoneAutoDetect' => true,
120 ],
121 ];
122 }
123
124 /**
125 * Get cake details fields
126 *
127 * @return array<int, array<string, mixed>>
128 */
129 private static function getCakeDetailsFields(): array
130 {
131 return array_merge(
132 self::getWeddingDateField(),
133 self::getGuestCountField(),
134 self::getCakeFlavorField(),
135 self::getNumberOfTiersField(),
136 self::getCakeStyleThemeField(),
137 self::getVenueAddressField(),
138 self::getAdditionalRequestsField()
139 );
140 }
141
142 /**
143 * Get wedding date field
144 *
145 * @return array<int, array<string, mixed>>
146 */
147 private static function getWeddingDateField(): array
148 {
149 return [
150 [
151 'id' => 0,
152 'fieldIndex' => 4,
153 'type' => 'date',
154 'label' => BackendStrings::getTemplateStrings()['wedding_date'],
155 'placeholder' => BackendStrings::getTemplateStrings()['select_wedding_date'],
156 'required' => true,
157 'parentId' => null,
158 'defaultValue' => '',
159 'position' => 4,
160 'dateFieldType' => 'picker',
161 'dateFormat' => 'MM/DD/YYYY',
162 ],
163 ];
164 }
165
166 /**
167 * Get number of guests field
168 *
169 * @return array<int, array<string, mixed>>
170 */
171 private static function getGuestCountField(): array
172 {
173 return [
174 [
175 'id' => 0,
176 'fieldIndex' => 5,
177 'type' => 'number',
178 'label' => BackendStrings::getTemplateStrings()['number_of_guests'],
179 'placeholder' => BackendStrings::getTemplateStrings()['eg_150'],
180 'required' => true,
181 'parentId' => null,
182 'position' => 5,
183 'minValue' => 1,
184 'maxValue' => 1000,
185 ],
186 ];
187 }
188
189 /**
190 * Get cake flavor field
191 *
192 * @return array<int, array<string, mixed>>
193 */
194 private static function getCakeFlavorField(): array
195 {
196 return [
197 [
198 'id' => 0,
199 'fieldIndex' => 6,
200 'type' => 'select',
201 'label' => BackendStrings::getTemplateStrings()['cake_flavors'],
202 'placeholder' => BackendStrings::getTemplateStrings()['select_cake_flavors'],
203 'required' => true,
204 'parentId' => null,
205 'defaultValue' => '',
206 'position' => 6,
207 'multiple' => true,
208 'fieldOptions' => [
209 [
210 'id' => 0,
211 'label' => BackendStrings::getTemplateStrings()['chocolate'],
212 'value' => 'chocolate',
213 'isDefault' => false,
214 'position' => 1
215 ],
216 [
217 'id' => 0,
218 'label' => BackendStrings::getTemplateStrings()['vanilla'],
219 'value' => 'vanilla',
220 'isDefault' => false,
221 'position' => 2
222 ],
223 [
224 'id' => 0,
225 'label' => BackendStrings::getTemplateStrings()['red_velvet'],
226 'value' => 'red_velvet',
227 'isDefault' => false,
228 'position' => 3
229 ],
230 [
231 'id' => 0,
232 'label' => BackendStrings::getTemplateStrings()['lemon'],
233 'value' => 'lemon',
234 'isDefault' => false,
235 'position' => 4
236 ],
237 [
238 'id' => 0,
239 'label' => BackendStrings::getTemplateStrings()['custom'],
240 'value' => 'custom',
241 'isDefault' => false,
242 'position' => 5
243 ],
244 ]
245 ],
246 ];
247 }
248
249 /**
250 * Get number of tiers field
251 *
252 * @return array<int, array<string, mixed>>
253 */
254 private static function getNumberOfTiersField(): array
255 {
256 return [
257 [
258 'id' => 0,
259 'fieldIndex' => 7,
260 'type' => 'number',
261 'label' => BackendStrings::getTemplateStrings()['number_of_tiers'],
262 'placeholder' => BackendStrings::getTemplateStrings()['eg_3'],
263 'required' => true,
264 'parentId' => null,
265 'position' => 7,
266 'minValue' => 1,
267 'maxValue' => 10,
268 ],
269 ];
270 }
271
272 /**
273 * Get cake style/theme field
274 *
275 * @return array<int, array<string, mixed>>
276 */
277 private static function getCakeStyleThemeField(): array
278 {
279 return [
280 [
281 'id' => 0,
282 'fieldIndex' => 8,
283 'type' => 'textarea',
284 'label' => BackendStrings::getTemplateStrings()['preferred_cake_style_theme'],
285 'placeholder' => BackendStrings::getTemplateStrings()['describe_theme_eg'],
286 'parentId' => null,
287 'defaultValue' => '',
288 'position' => 8,
289 'required' => true,
290 'rows' => 3,
291 ],
292 ];
293 }
294
295 /**
296 * Get venue address field
297 *
298 * @return array<int, array<string, mixed>>
299 */
300 private static function getVenueAddressField(): array
301 {
302 return [
303 // Address Field - Parent
304 [
305 'id' => 0,
306 'fieldIndex' => 9,
307 'type' => 'address',
308 'label' => BackendStrings::getTemplateStrings()['venue_address'],
309 'parentId' => null,
310 'defaultValue' => '',
311 'placeholder' => '',
312 'readonly' => false,
313 'position' => 9,
314 'required' => true,
315 ],
316 // Street Address - Child of Address Field
317 [
318 'id' => 0,
319 'type' => 'text',
320 'label' => BackendStrings::getTemplateStrings()['address_line_1'],
321 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_1'],
322 'required' => true,
323 'parentId' => 0,
324 'fieldIndex' => 9,
325 'defaultValue' => '',
326 'position' => 9,
327 'hideLabel' => false,
328 'description' => '',
329 'addressType' => 'streetAddress',
330 'settings' => json_encode([
331 'type' => 'streetAddress',
332 'hideLabel' => false,
333 'description' => '',
334 'placeholder' => BackendStrings::getTemplateStrings()['address_line_1'],
335 'requiredMessage' => '',
336 'visible' => true
337 ]),
338 ],
339 // Address Line 2 - Child of Address Field
340 [
341 'id' => 0,
342 'type' => 'text',
343 'label' => BackendStrings::getTemplateStrings()['address_line_2'],
344 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_2'],
345 'required' => false,
346 'parentId' => 0,
347 'fieldIndex' => 9,
348 'defaultValue' => '',
349 'position' => 9,
350 'hideLabel' => false,
351 'description' => '',
352 'addressType' => 'addressLine2',
353 'settings' => json_encode([
354 'type' => 'addressLine2',
355 'hideLabel' => false,
356 'description' => '',
357 'placeholder' => BackendStrings::getTemplateStrings()['address_line_2'],
358 'requiredMessage' => '',
359 'visible' => true
360 ]),
361 ],
362 // City - Child of Address Field
363 [
364 'id' => 0,
365 'type' => 'text',
366 'label' => BackendStrings::getTemplateStrings()['city'],
367 'placeholder' => BackendStrings::getTemplateStrings()['city'],
368 'required' => true,
369 'parentId' => 0,
370 'fieldIndex' => 9,
371 'defaultValue' => '',
372 'position' => 9,
373 'hideLabel' => false,
374 'description' => '',
375 'addressType' => 'city',
376 'settings' => json_encode([
377 'type' => 'city',
378 'hideLabel' => false,
379 'description' => '',
380 'placeholder' => BackendStrings::getTemplateStrings()['city'],
381 'requiredMessage' => '',
382 'visible' => true
383 ]),
384 ],
385 // State/Province - Child of Address Field
386 [
387 'id' => 0,
388 'type' => 'text',
389 'label' => BackendStrings::getTemplateStrings()['state_province'],
390 'placeholder' => BackendStrings::getTemplateStrings()['state'],
391 'required' => true,
392 'parentId' => 0,
393 'fieldIndex' => 9,
394 'defaultValue' => '',
395 'position' => 9,
396 'hideLabel' => false,
397 'description' => '',
398 'addressType' => 'state',
399 'settings' => json_encode([
400 'type' => 'state',
401 'hideLabel' => false,
402 'description' => '',
403 'placeholder' => BackendStrings::getTemplateStrings()['state'],
404 'requiredMessage' => '',
405 'visible' => true
406 ]),
407 ],
408 // Zip/Postal Code - Child of Address Field
409 [
410 'id' => 0,
411 'type' => 'text',
412 'label' => BackendStrings::getTemplateStrings()['zip_postal_code'],
413 'placeholder' => BackendStrings::getTemplateStrings()['zip'],
414 'required' => true,
415 'parentId' => 0,
416 'fieldIndex' => 9,
417 'defaultValue' => '',
418 'position' => 9,
419 'hideLabel' => false,
420 'description' => '',
421 'addressType' => 'zip',
422 'settings' => json_encode([
423 'type' => 'zip',
424 'hideLabel' => false,
425 'description' => '',
426 'placeholder' => BackendStrings::getTemplateStrings()['zip'],
427 'requiredMessage' => '',
428 'visible' => true
429 ]),
430 ],
431 // Country - Child of Address Field
432 [
433 'id' => 0,
434 'type' => 'text',
435 'label' => BackendStrings::getTemplateStrings()['country'],
436 'placeholder' => BackendStrings::getTemplateStrings()['select_country'],
437 'required' => true,
438 'parentId' => 0,
439 'fieldIndex' => 9,
440 'defaultValue' => '',
441 'position' => 9,
442 'hideLabel' => false,
443 'description' => '',
444 'addressType' => 'country',
445 'settings' => json_encode([
446 'type' => 'country',
447 'hideLabel' => false,
448 'description' => '',
449 'placeholder' => BackendStrings::getTemplateStrings()['select_country'],
450 'requiredMessage' => '',
451 'visible' => true
452 ]),
453 ],
454 ];
455 }
456
457 /**
458 * Get additional requests field
459 *
460 * @return array<int, array<string, mixed>>
461 */
462 private static function getAdditionalRequestsField(): array
463 {
464 return [
465 [
466 'id' => 0,
467 'fieldIndex' => 10,
468 'type' => 'textarea',
469 'label' => BackendStrings::getTemplateStrings()['additional_requests'],
470 'placeholder' => BackendStrings::getTemplateStrings()['any_special_instructions_or_details'],
471 'parentId' => null,
472 'defaultValue' => '',
473 'position' => 10,
474 'required' => false,
475 'rows' => 3,
476 ],
477 ];
478 }
479
480 /**
481 * Get delivery details fields
482 *
483 * @return array<int, array<string, mixed>>
484 */
485 private static function getDeliveryDetailsFields(): array
486 {
487 return [];
488 }
489 }
490