PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
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 / BabyShowerCakeOrderFormTemplate.php

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

457 lines 16.4 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 BabyShowerCakeOrderFormTemplate
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' => 'baby_shower_cake_order_form',
18 'name' => BackendStrings::getTemplateStrings()['baby_shower_cake_order_form'],
19 'description' => BackendStrings::getTemplateStrings()['baby_shower_cake_order_form_desc'],
20 'category' => 'order-forms',
21 'subcategory' => 'cake-order-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'baby-shower-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()['baby_shower_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::getThemeAndDesignFields(),
47 self::getEventAndDeliveryFields()
48 ),
49 'settings' => []
50 ]
51 ]
52 );
53 }
54
55 /**
56 * Parent(s) Name(s), email, phone
57 *
58 * @return array<int, array<string, mixed>>
59 */
60 private static function getCustomerInformationFields(): array
61 {
62 return [
63 // Parent(s) Name(s)
64 [
65 'id' => 1,
66 'fieldIndex' => 1,
67 'type' => 'text',
68 'label' => BackendStrings::getTemplateStrings()['parents_names'],
69 'placeholder' => BackendStrings::getTemplateStrings()['enter_parents_names'],
70 'required' => true,
71 'parentId' => null,
72 'defaultValue' => '',
73 'position' => 1,
74 ],
75 // Email Address
76 [
77 'id' => 2,
78 'fieldIndex' => 2,
79 'type' => 'email',
80 'label' => BackendStrings::getTemplateStrings()['email_address'],
81 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_email'],
82 'required' => true,
83 'parentId' => null,
84 'defaultValue' => '',
85 'position' => 2,
86 ],
87 // Phone Number
88 [
89 'id' => 3,
90 'fieldIndex' => 3,
91 'type' => 'phone',
92 'label' => BackendStrings::getTemplateStrings()['phone_number'],
93 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_phone_number'],
94 'required' => true,
95 'parentId' => null,
96 'defaultValue' => '',
97 'position' => 3,
98 'phoneAutoDetect' => true,
99 ],
100 ];
101 }
102
103 /**
104 * Cake flavor and size
105 *
106 * @return array<int, array<string, mixed>>
107 */
108 private static function getCakeDetailsFields(): array
109 {
110 return [
111 // Cake Flavor
112 [
113 'id' => 9,
114 'fieldIndex' => 4,
115 'type' => 'select',
116 'label' => BackendStrings::getTemplateStrings()['cake_flavor'],
117 'placeholder' => BackendStrings::getTemplateStrings()['select_cake_flavor'],
118 'required' => true,
119 'parentId' => null,
120 'defaultValue' => '',
121 'position' => 4,
122 'fieldOptions' => [
123 [
124 'id' => 4,
125 'label' => BackendStrings::getTemplateStrings()['chocolate'],
126 'value' => 'chocolate',
127 'isDefault' => false,
128 'position' => 1,
129 ],
130 [
131 'id' => 5,
132 'label' => BackendStrings::getTemplateStrings()['vanilla'],
133 'value' => 'vanilla',
134 'isDefault' => false,
135 'position' => 2,
136 ],
137 [
138 'id' => 6,
139 'label' => BackendStrings::getTemplateStrings()['strawberry'],
140 'value' => 'strawberry',
141 'isDefault' => false,
142 'position' => 3,
143 ],
144 [
145 'id' => 7,
146 'label' => BackendStrings::getTemplateStrings()['lemon'],
147 'value' => 'lemon',
148 'isDefault' => false,
149 'position' => 4,
150 ],
151 [
152 'id' => 8,
153 'label' => BackendStrings::getTemplateStrings()['custom'],
154 'value' => 'custom',
155 'isDefault' => false,
156 'position' => 5,
157 ],
158 ],
159 ],
160 // Cake Size
161 [
162 'id' => 13,
163 'fieldIndex' => 5,
164 'type' => 'select',
165 'label' => BackendStrings::getTemplateStrings()['cake_size'],
166 'placeholder' => BackendStrings::getTemplateStrings()['select_cake_size'],
167 'required' => true,
168 'parentId' => null,
169 'defaultValue' => '',
170 'position' => 5,
171 'fieldOptions' => [
172 [
173 'id' => 10,
174 'label' => BackendStrings::getTemplateStrings()['small_6_inch'],
175 'value' => 'small_6',
176 'isDefault' => false,
177 'position' => 1,
178 ],
179 [
180 'id' => 11,
181 'label' => BackendStrings::getTemplateStrings()['medium_8_inch'],
182 'value' => 'medium_8',
183 'isDefault' => false,
184 'position' => 2,
185 ],
186 [
187 'id' => 12,
188 'label' => BackendStrings::getTemplateStrings()['large_10_inch'],
189 'value' => 'large_10',
190 'isDefault' => false,
191 'position' => 3,
192 ],
193 ],
194 ],
195 ];
196 }
197
198 /**
199 * Theme, cake message, design ideas
200 *
201 * @return array<int, array<string, mixed>>
202 */
203 private static function getThemeAndDesignFields(): array
204 {
205 return [
206 // Baby Shower Theme
207 [
208 'id' => 14,
209 'fieldIndex' => 6,
210 'type' => 'text',
211 'label' => BackendStrings::getTemplateStrings()['baby_shower_theme'],
212 'placeholder' => BackendStrings::getTemplateStrings()['eg_little_prince_twinklle_pink_gold'],
213 'required' => true,
214 'parentId' => null,
215 'defaultValue' => '',
216 'position' => 6,
217 ],
218 // Cake Message
219 [
220 'id' => 15,
221 'fieldIndex' => 7,
222 'type' => 'text',
223 'label' => BackendStrings::getTemplateStrings()['cake_message'],
224 'placeholder' => BackendStrings::getTemplateStrings()['welcome_baby_emma'],
225 'required' => true,
226 'parentId' => null,
227 'defaultValue' => '',
228 'position' => 7,
229 ],
230 // Design Ideas / Requests
231 [
232 'id' => 16,
233 'fieldIndex' => 8,
234 'type' => 'textarea',
235 'label' => BackendStrings::getTemplateStrings()['design_ideas_requests'],
236 'placeholder' => BackendStrings::getTemplateStrings()['describe_your_design_ideas_or_color_scheme'],
237 'required' => false,
238 'parentId' => null,
239 'defaultValue' => '',
240 'position' => 8,
241 'rows' => 4,
242 ],
243 ];
244 }
245
246 /**
247 * Event date and delivery address (address field structure)
248 *
249 * @return array<int, array<string, mixed>>
250 */
251 private static function getEventAndDeliveryFields(): array
252 {
253 return array_merge(
254 self::getEventDateFields(),
255 self::getDeliveryAddressFields()
256 );
257 }
258
259 /**
260 * Event date fields
261 *
262 * @return array<int, array<string, mixed>>
263 */
264 private static function getEventDateFields(): array
265 {
266 return [
267 // Event Date
268 [
269 'id' => 17,
270 'fieldIndex' => 9,
271 'type' => 'date',
272 'label' => BackendStrings::getTemplateStrings()['event_date'],
273 'placeholder' => BackendStrings::getTemplateStrings()['select_event_date'],
274 'required' => true,
275 'parentId' => null,
276 'defaultValue' => '',
277 'position' => 9,
278 'dateFieldType' => 'picker',
279 'dateFormat' => 'MM/DD/YYYY',
280 ],
281 ];
282 }
283
284 /**
285 * Delivery address fields
286 *
287 * @return array<int, array<string, mixed>>
288 */
289 private static function getDeliveryAddressFields(): array
290 {
291 return [
292 // Delivery Address Field - Parent
293 [
294 'id' => 18,
295 'fieldIndex' => 10,
296 'type' => 'address',
297 'label' => BackendStrings::getTemplateStrings()['delivery_address'],
298 'parentId' => null,
299 'defaultValue' => '',
300 'placeholder' => '',
301 'readonly' => false,
302 'position' => 10,
303 ],
304 // Address Line 1 - Child of Address Field (required)
305 [
306 'id' => 20,
307 'type' => 'text',
308 'label' => BackendStrings::getTemplateStrings()['address_line_1'],
309 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_1'],
310 'required' => true,
311 'parentId' => 10,
312 'fieldIndex' => 10,
313 'defaultValue' => '',
314 'position' => 1,
315 'hideLabel' => false,
316 'description' => '',
317 'addressType' => 'streetAddress',
318 'settings' => json_encode(
319 [
320 'type' => 'streetAddress',
321 'hideLabel' => false,
322 'description' => '',
323 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_1'],
324 'requiredMessage' => '',
325 'visible' => true,
326 ]
327 ),
328 ],
329 // Address Line 2 - Child of Address Field (NOT required)
330 [
331 'id' => 22,
332 'type' => 'text',
333 'label' => BackendStrings::getTemplateStrings()['address_line_2'],
334 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_2'],
335 'required' => false,
336 'parentId' => 10,
337 'fieldIndex' => 10,
338 'defaultValue' => '',
339 'position' => 2,
340 'hideLabel' => false,
341 'description' => '',
342 'addressType' => 'addressLine2',
343 'settings' => json_encode(
344 [
345 'type' => 'addressLine2',
346 'hideLabel' => false,
347 'description' => '',
348 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_2'],
349 'requiredMessage' => '',
350 'visible' => true,
351 ]
352 ),
353 ],
354 // City - Child of Address Field (required)
355 [
356 'id' => 24,
357 'type' => 'text',
358 'label' => BackendStrings::getTemplateStrings()['city'],
359 'placeholder' => BackendStrings::getTemplateStrings()['city'],
360 'required' => true,
361 'parentId' => 10,
362 'fieldIndex' => 10,
363 'defaultValue' => '',
364 'position' => 3,
365 'hideLabel' => false,
366 'description' => '',
367 'addressType' => 'city',
368 'settings' => json_encode(
369 [
370 'type' => 'city',
371 'hideLabel' => false,
372 'description' => '',
373 'placeholder' => BackendStrings::getTemplateStrings()['city'],
374 'requiredMessage' => '',
375 'visible' => true,
376 ]
377 ),
378 ],
379 // State/Province - Child of Address Field (required)
380 [
381 'id' => 26,
382 'type' => 'text',
383 'label' => BackendStrings::getTemplateStrings()['state_province'],
384 'placeholder' => BackendStrings::getTemplateStrings()['state'],
385 'required' => true,
386 'parentId' => 10,
387 'fieldIndex' => 10,
388 'defaultValue' => '',
389 'position' => 4,
390 'hideLabel' => false,
391 'description' => '',
392 'addressType' => 'state',
393 'settings' => json_encode(
394 [
395 'type' => 'state',
396 'hideLabel' => false,
397 'description' => '',
398 'placeholder' => BackendStrings::getTemplateStrings()['state'],
399 'requiredMessage' => '',
400 'visible' => true,
401 ]
402 ),
403 ],
404 // Zip/Postal Code - Child of Address Field (required)
405 [
406 'id' => 28,
407 'type' => 'text',
408 'label' => BackendStrings::getTemplateStrings()['zip_postal_code'],
409 'placeholder' => BackendStrings::getTemplateStrings()['zip'],
410 'required' => true,
411 'parentId' => 10,
412 'fieldIndex' => 10,
413 'defaultValue' => '',
414 'position' => 5,
415 'hideLabel' => false,
416 'description' => '',
417 'addressType' => 'zip',
418 'settings' => json_encode(
419 [
420 'type' => 'zip',
421 'hideLabel' => false,
422 'description' => '',
423 'placeholder' => BackendStrings::getTemplateStrings()['zip'],
424 'requiredMessage' => '',
425 'visible' => true,
426 ]
427 ),
428 ],
429 // Country - Child of Address Field (required)
430 [
431 'id' => 30,
432 'type' => 'text',
433 'label' => BackendStrings::getTemplateStrings()['country'],
434 'placeholder' => BackendStrings::getTemplateStrings()['select_country'],
435 'required' => true,
436 'parentId' => 10,
437 'fieldIndex' => 10,
438 'defaultValue' => '',
439 'position' => 6,
440 'hideLabel' => false,
441 'description' => '',
442 'addressType' => 'country',
443 'settings' => json_encode(
444 [
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