PluginProbe
The Innovative Form Builder – IvyForms / 0.7
The Innovative Form Builder – IvyForms v0.7
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.7, at backend/src/Services/Template/WeddingCakeOrderFormTemplate.php

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