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
← All changes | backend/src/Services/Template/CustomCakeOrderFormTemplate.php +48 -39 0.8.2 → 1.5 View file →
@@ -1,23 +1,18 @@
1 1 <?php
2 2
3 3 namespace IvyForms\Services\Template;
4 4
5 -// phpcs:disable PSR1.Files.SideEffects
6 -if (!defined('ABSPATH')) {
7 - exit; // Exit if accessed directly
8 -}
9 -
10 5 use IvyForms\Services\Translations\BackendStrings;
11 6
12 7 class CustomCakeOrderFormTemplate
13 8 {
14 9 /**
15 - * Get the custom cake order form template
10 + * Get template metadata (without form_data)
16 11 *
17 12 * @return array<string, mixed>
18 13 */
19 - public static function getTemplate(): array
14 + public static function getTemplateMeta(): array
20 15 {
21 16 return [
22 17 'id' => 'custom_cake_order_form',
23 18 'name' => BackendStrings::getTemplateStrings()['custom_cake_order_form'],
@@ -24,9 +19,22 @@
24 19 'description' => BackendStrings::getTemplateStrings()['custom_cake_order_form_desc'],
25 20 'category' => 'order-forms',
26 21 'subcategory' => 'cake-order-forms',
27 22 'is_pro' => false,
28 - 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'custom-cake-order-form.svg',
23 + 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'custom-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 + [
29 37 'form_data' => [
30 38 'name' => BackendStrings::getTemplateStrings()['custom_cake_order_form'],
31 39 'published' => 1,
32 40 'showTitle' => 1,
@@ -38,9 +46,10 @@
38 46 self::getDeliveryDetailsFields()
39 47 ),
40 48 'settings' => []
41 49 ]
42 - ];
50 + ]
51 + );
43 52 }
44 53
45 54 /**
46 55 * Get customer information fields
@@ -51,9 +60,9 @@
51 60 {
52 61 return [
53 62 // Name Field - Parent
54 63 [
55 - 'id' => 0,
64 + 'id' => 1,
56 65 'fieldIndex' => 1,
57 66 'type' => 'name',
58 67 'label' => BackendStrings::getTemplateStrings()['full_name'],
59 68 'parentId' => null,
@@ -64,14 +73,14 @@
64 73 'position' => 1,
65 74 ],
66 75 // First Name - Child of Name Field
67 76 [
68 - 'id' => 0,
77 + 'id' => 2,
69 78 'type' => 'text',
70 79 'label' => BackendStrings::getNewFormStrings()['first_name'],
71 80 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
72 81 'required' => true,
73 - 'parentId' => 0,
82 + 'parentId' => 1,
74 83 'fieldIndex' => 1,
75 84 'defaultValue' => '',
76 85 'position' => 1,
77 86 'optionHide' => false,
@@ -79,14 +88,14 @@
79 88 'settings' => json_encode(['nameFieldType' => 'nameField1']),
80 89 ],
81 90 // Last Name - Child of Name Field
82 91 [
83 - 'id' => 0,
92 + 'id' => 3,
84 93 'type' => 'text',
85 94 'label' => BackendStrings::getNewFormStrings()['last_name'],
86 95 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
87 96 'required' => true,
88 - 'parentId' => 0,
97 + 'parentId' => 1,
89 98 'fieldIndex' => 1,
90 99 'defaultValue' => '',
91 100 'position' => 2,
92 101 'optionHide' => false,
@@ -94,9 +103,9 @@
94 103 'settings' => json_encode(['nameFieldType' => 'nameField2']),
95 104 ],
96 105 // Email Address
97 106 [
98 - 'id' => 0,
107 + 'id' => 4,
99 108 'fieldIndex' => 2,
100 109 'type' => 'email',
101 110 'label' => BackendStrings::getTemplateStrings()['email_address'],
102 111 'placeholder' => 'enter_your_email_address',
@@ -106,9 +115,9 @@
106 115 'position' => 2,
107 116 ],
108 117 // Phone Number
109 118 [
110 - 'id' => 0,
119 + 'id' => 5,
111 120 'fieldIndex' => 3,
112 121 'type' => 'phone',
113 122 'label' => BackendStrings::getTemplateStrings()['phone_number'],
114 123 'placeholder' => '+1 (_) _-_',
@@ -145,9 +154,9 @@
145 154 private static function getOccasionField(): array
146 155 {
147 156 return [
148 157 [
149 - 'id' => 0,
158 + 'id' => 12,
150 159 'fieldIndex' => 4,
151 160 'type' => 'select',
152 161 'label' => BackendStrings::getTemplateStrings()['occasion'],
153 162 'placeholder' => BackendStrings::getTemplateStrings()['select_the_occasion'],
@@ -156,9 +165,9 @@
156 165 'defaultValue' => '',
157 166 'position' => 4,
158 167 'fieldOptions' => [
159 168 [
160 - 'id' => 0,
169 + 'id' => 6,
161 170 'label' => BackendStrings::getTemplateStrings()['birthday'],
162 171 'value' => 'birthday',
163 172 'isDefault' => false,
164 173 'position' => 1
@@ -163,9 +172,9 @@
163 172 'isDefault' => false,
164 173 'position' => 1
165 174 ],
166 175 [
167 - 'id' => 0,
176 + 'id' => 7,
168 177 'label' => BackendStrings::getTemplateStrings()['wedding'],
169 178 'value' => 'wedding',
170 179 'isDefault' => false,
171 180 'position' => 2
@@ -170,9 +179,9 @@
170 179 'isDefault' => false,
171 180 'position' => 2
172 181 ],
173 182 [
174 - 'id' => 0,
183 + 'id' => 8,
175 184 'label' => BackendStrings::getTemplateStrings()['anniversary'],
176 185 'value' => 'anniversary',
177 186 'isDefault' => false,
178 187 'position' => 3
@@ -177,9 +186,9 @@
177 186 'isDefault' => false,
178 187 'position' => 3
179 188 ],
180 189 [
181 - 'id' => 0,
190 + 'id' => 9,
182 191 'label' => BackendStrings::getTemplateStrings()['baby_shower'],
183 192 'value' => 'baby_shower',
184 193 'isDefault' => false,
185 194 'position' => 4
@@ -184,9 +193,9 @@
184 193 'isDefault' => false,
185 194 'position' => 4
186 195 ],
187 196 [
188 - 'id' => 0,
197 + 'id' => 10,
189 198 'label' => BackendStrings::getTemplateStrings()['graduation'],
190 199 'value' => 'graduation',
191 200 'isDefault' => false,
192 201 'position' => 5
@@ -191,9 +200,9 @@
191 200 'isDefault' => false,
192 201 'position' => 5
193 202 ],
194 203 [
195 - 'id' => 0,
204 + 'id' => 11,
196 205 'label' => BackendStrings::getTemplateStrings()['other'],
197 206 'value' => 'other',
198 207 'isDefault' => false,
199 208 'position' => 6
@@ -211,9 +220,9 @@
211 220 private static function getCakeFlavorField(): array
212 221 {
213 222 return [
214 223 [
215 - 'id' => 0,
224 + 'id' => 19,
216 225 'fieldIndex' => 5,
217 226 'type' => 'select',
218 227 'label' => BackendStrings::getTemplateStrings()['cake_flavor'],
219 228 'placeholder' => BackendStrings::getTemplateStrings()['choose_cake_flavor'],
@@ -222,9 +231,9 @@
222 231 'defaultValue' => '',
223 232 'position' => 5,
224 233 'fieldOptions' => [
225 234 [
226 - 'id' => 0,
235 + 'id' => 13,
227 236 'label' => BackendStrings::getTemplateStrings()['chocolate'],
228 237 'value' => 'chocolate',
229 238 'isDefault' => false,
230 239 'position' => 1
@@ -229,9 +238,9 @@
229 238 'isDefault' => false,
230 239 'position' => 1
231 240 ],
232 241 [
233 - 'id' => 0,
242 + 'id' => 14,
234 243 'label' => BackendStrings::getTemplateStrings()['vanilla'],
235 244 'value' => 'vanilla',
236 245 'isDefault' => false,
237 246 'position' => 2
@@ -236,9 +245,9 @@
236 245 'isDefault' => false,
237 246 'position' => 2
238 247 ],
239 248 [
240 - 'id' => 0,
249 + 'id' => 15,
241 250 'label' => BackendStrings::getTemplateStrings()['red_velvet'],
242 251 'value' => 'red_velvet',
243 252 'isDefault' => false,
244 253 'position' => 3
@@ -243,9 +252,9 @@
243 252 'isDefault' => false,
244 253 'position' => 3
245 254 ],
246 255 [
247 - 'id' => 0,
256 + 'id' => 16,
248 257 'label' => BackendStrings::getTemplateStrings()['lemon'],
249 258 'value' => 'lemon',
250 259 'isDefault' => false,
251 260 'position' => 4
@@ -250,9 +259,9 @@
250 259 'isDefault' => false,
251 260 'position' => 4
252 261 ],
253 262 [
254 - 'id' => 0,
263 + 'id' => 17,
255 264 'label' => BackendStrings::getTemplateStrings()['marble'],
256 265 'value' => 'marble',
257 266 'isDefault' => false,
258 267 'position' => 5
@@ -257,9 +266,9 @@
257 266 'isDefault' => false,
258 267 'position' => 5
259 268 ],
260 269 [
261 - 'id' => 0,
270 + 'id' => 18,
262 271 'label' => BackendStrings::getTemplateStrings()['other'],
263 272 'value' => 'other',
264 273 'isDefault' => false,
265 274 'position' => 6
@@ -277,9 +286,9 @@
277 286 private static function getCakeSizeField(): array
278 287 {
279 288 return [
280 289 [
281 - 'id' => 0,
290 + 'id' => 24,
282 291 'fieldIndex' => 6,
283 292 'type' => 'select',
284 293 'label' => BackendStrings::getTemplateStrings()['cake_size'],
285 294 'placeholder' => BackendStrings::getTemplateStrings()['select_cake_size'],
@@ -288,9 +297,9 @@
288 297 'defaultValue' => '',
289 298 'position' => 6,
290 299 'fieldOptions' => [
291 300 [
292 - 'id' => 0,
301 + 'id' => 20,
293 302 'label' => BackendStrings::getTemplateStrings()['6_inch_serves_8'],
294 303 'value' => '6_inch',
295 304 'isDefault' => false,
296 305 'position' => 1
@@ -295,9 +304,9 @@
295 304 'isDefault' => false,
296 305 'position' => 1
297 306 ],
298 307 [
299 - 'id' => 0,
308 + 'id' => 21,
300 309 'label' => BackendStrings::getTemplateStrings()['8_inch_serves_12'],
301 310 'value' => '8_inch',
302 311 'isDefault' => false,
303 312 'position' => 2
@@ -302,9 +311,9 @@
302 311 'isDefault' => false,
303 312 'position' => 2
304 313 ],
305 314 [
306 - 'id' => 0,
315 + 'id' => 22,
307 316 'label' => BackendStrings::getTemplateStrings()['10_inch_serves_20'],
308 317 'value' => '10_inch',
309 318 'isDefault' => false,
310 319 'position' => 3
@@ -309,9 +318,9 @@
309 318 'isDefault' => false,
310 319 'position' => 3
311 320 ],
312 321 [
313 - 'id' => 0,
322 + 'id' => 23,
314 323 'label' => BackendStrings::getTemplateStrings()['tiered_custom_size'],
315 324 'value' => 'tiered_custom',
316 325 'isDefault' => false,
317 326 'position' => 4
@@ -329,9 +338,9 @@
329 338 private static function getDesignInspirationField(): array
330 339 {
331 340 return [
332 341 [
333 - 'id' => 0,
342 + 'id' => 25,
334 343 'fieldIndex' => 7,
335 344 'type' => 'website',
336 345 'label' => BackendStrings::getTemplateStrings()['design_inspiration_link'],
337 346 'placeholder' => BackendStrings::getTemplateStrings()['paste_link_design_inspiration'],
@@ -351,9 +360,9 @@
351 360 private static function getCakeMessageField(): array
352 361 {
353 362 return [
354 363 [
355 - 'id' => 0,
364 + 'id' => 26,
356 365 'fieldIndex' => 8,
357 366 'type' => 'text',
358 367 'label' => BackendStrings::getTemplateStrings()['cake_message'],
359 368 'placeholder' => BackendStrings::getTemplateStrings()['enter_short_message_for_cake'],
@@ -374,9 +383,9 @@
374 383 {
375 384 return [
376 385 // Delivery Date
377 386 [
378 - 'id' => 0,
387 + 'id' => 27,
379 388 'fieldIndex' => 9,
380 389 'type' => 'date',
381 390 'label' => BackendStrings::getTemplateStrings()['delivery_date'],
382 391 'placeholder' => BackendStrings::getTemplateStrings()['select_delivery_date'],
@@ -388,9 +397,9 @@
388 397 'dateFormat' => 'MM/DD/YYYY',
389 398 ],
390 399 // Additional Notes
391 400 [
392 - 'id' => 0,
401 + 'id' => 28,
393 402 'fieldIndex' => 10,
394 403 'type' => 'textarea',
395 404 'label' => BackendStrings::getTemplateStrings()['additional_notes'],
396 405 'placeholder' => BackendStrings::getTemplateStrings()['write_additional_instructions_or_preferences'],