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

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

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