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

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

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