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

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