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

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

411 lines 15.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 // 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' => 0,
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' => 0,
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' => 0,
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' => 0,
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' => 0,
116 'label' => BackendStrings::getTemplateStrings()['chocolate'],
117 'value' => 'chocolate',
118 'isDefault' => false,
119 'position' => 1,
120 ],
121 [
122 'id' => 0,
123 'label' => BackendStrings::getTemplateStrings()['vanilla'],
124 'value' => 'vanilla',
125 'isDefault' => false,
126 'position' => 2,
127 ],
128 [
129 'id' => 0,
130 'label' => BackendStrings::getTemplateStrings()['strawberry'],
131 'value' => 'strawberry',
132 'isDefault' => false,
133 'position' => 3,
134 ],
135 [
136 'id' => 0,
137 'label' => BackendStrings::getTemplateStrings()['lemon'],
138 'value' => 'lemon',
139 'isDefault' => false,
140 'position' => 4,
141 ],
142 [
143 'id' => 0,
144 'label' => BackendStrings::getTemplateStrings()['custom'],
145 'value' => 'custom',
146 'isDefault' => false,
147 'position' => 5,
148 ],
149 ],
150 ],
151 // Cake Size
152 [
153 'id' => 0,
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' => 0,
165 'label' => BackendStrings::getTemplateStrings()['small_6_inch'],
166 'value' => 'small_6',
167 'isDefault' => false,
168 'position' => 1,
169 ],
170 [
171 'id' => 0,
172 'label' => BackendStrings::getTemplateStrings()['medium_8_inch'],
173 'value' => 'medium_8',
174 'isDefault' => false,
175 'position' => 2,
176 ],
177 [
178 'id' => 0,
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' => 0,
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' => 0,
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' => 0,
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' => 0,
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 'dateFormat' => 'MM/DD/YYYY',
257 ],
258 // Delivery Address Field - Parent
259 [
260 'id' => 0,
261 'fieldIndex' => 10,
262 'type' => 'address',
263 'label' => BackendStrings::getTemplateStrings()['delivery_address'],
264 'parentId' => null,
265 'defaultValue' => '',
266 'placeholder' => '',
267 'readonly' => false,
268 'position' => 10,
269 ],
270 // Address Line 1 - Child of Address Field (required)
271 [
272 'id' => 0,
273 'type' => 'text',
274 'label' => BackendStrings::getTemplateStrings()['address_line_1'],
275 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_1'],
276 'required' => true,
277 'parentId' => 0,
278 'fieldIndex' => 10,
279 'defaultValue' => '',
280 'position' => 1,
281 'hideLabel' => false,
282 'description' => '',
283 'addressType' => 'streetAddress',
284 'settings' => json_encode([
285 'type' => 'streetAddress',
286 'hideLabel' => false,
287 'description' => '',
288 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_1'],
289 'requiredMessage' => '',
290 'visible' => true,
291 ]),
292 ],
293 // Address Line 2 - Child of Address Field (NOT required)
294 [
295 'id' => 0,
296 'type' => 'text',
297 'label' => BackendStrings::getTemplateStrings()['address_line_2'],
298 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_2'],
299 'required' => false,
300 'parentId' => 0,
301 'fieldIndex' => 10,
302 'defaultValue' => '',
303 'position' => 2,
304 'hideLabel' => false,
305 'description' => '',
306 'addressType' => 'addressLine2',
307 'settings' => json_encode([
308 'type' => 'addressLine2',
309 'hideLabel' => false,
310 'description' => '',
311 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_2'],
312 'requiredMessage' => '',
313 'visible' => true,
314 ]),
315 ],
316 // City - Child of Address Field (required)
317 [
318 'id' => 0,
319 'type' => 'text',
320 'label' => BackendStrings::getTemplateStrings()['city'],
321 'placeholder' => BackendStrings::getTemplateStrings()['city'],
322 'required' => true,
323 'parentId' => 0,
324 'fieldIndex' => 10,
325 'defaultValue' => '',
326 'position' => 3,
327 'hideLabel' => false,
328 'description' => '',
329 'addressType' => 'city',
330 'settings' => json_encode([
331 'type' => 'city',
332 'hideLabel' => false,
333 'description' => '',
334 'placeholder' => BackendStrings::getTemplateStrings()['city'],
335 'requiredMessage' => '',
336 'visible' => true,
337 ]),
338 ],
339 // State/Province - Child of Address Field (required)
340 [
341 'id' => 0,
342 'type' => 'text',
343 'label' => BackendStrings::getTemplateStrings()['state_province'],
344 'placeholder' => BackendStrings::getTemplateStrings()['state'],
345 'required' => true,
346 'parentId' => 0,
347 'fieldIndex' => 10,
348 'defaultValue' => '',
349 'position' => 4,
350 'hideLabel' => false,
351 'description' => '',
352 'addressType' => 'state',
353 'settings' => json_encode([
354 'type' => 'state',
355 'hideLabel' => false,
356 'description' => '',
357 'placeholder' => BackendStrings::getTemplateStrings()['state'],
358 'requiredMessage' => '',
359 'visible' => true,
360 ]),
361 ],
362 // Zip/Postal Code - Child of Address Field (required)
363 [
364 'id' => 0,
365 'type' => 'text',
366 'label' => BackendStrings::getTemplateStrings()['zip_postal_code'],
367 'placeholder' => BackendStrings::getTemplateStrings()['zip'],
368 'required' => true,
369 'parentId' => 0,
370 'fieldIndex' => 10,
371 'defaultValue' => '',
372 'position' => 5,
373 'hideLabel' => false,
374 'description' => '',
375 'addressType' => 'zip',
376 'settings' => json_encode([
377 'type' => 'zip',
378 'hideLabel' => false,
379 'description' => '',
380 'placeholder' => BackendStrings::getTemplateStrings()['zip'],
381 'requiredMessage' => '',
382 'visible' => true,
383 ]),
384 ],
385 // Country - Child of Address Field (required)
386 [
387 'id' => 0,
388 'type' => 'text',
389 'label' => BackendStrings::getTemplateStrings()['country'],
390 'placeholder' => BackendStrings::getTemplateStrings()['select_country'],
391 'required' => true,
392 'parentId' => 0,
393 'fieldIndex' => 10,
394 'defaultValue' => '',
395 'position' => 6,
396 'hideLabel' => false,
397 'description' => '',
398 'addressType' => 'country',
399 'settings' => json_encode([
400 'type' => 'country',
401 'hideLabel' => false,
402 'description' => '',
403 'placeholder' => BackendStrings::getTemplateStrings()['select_country'],
404 'requiredMessage' => '',
405 'visible' => true,
406 ]),
407 ],
408 ];
409 }
410 }
411