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