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/KitchenUpgradeChangeFormTemplate.php +77 -56 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 KitchenUpgradeChangeFormTemplate
13 8 {
14 9 /**
15 - * Get the kitchen upgrade change 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' => 'kitchen_upgrade_change_form',
23 18 'name' => BackendStrings::getTemplateStrings()['kitchen_upgrade_change_form'],
@@ -24,9 +19,22 @@
24 19 'description' => BackendStrings::getTemplateStrings()['kitchen_upgrade_change_form_desc'],
25 20 'category' => 'order-forms',
26 21 'subcategory' => 'change-order-forms',
27 22 'is_pro' => false,
28 - 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'kitchen-upgrade-change-form.svg',
23 + 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'kitchen-upgrade-change-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()['kitchen_upgrade_change_form'],
31 39 'published' => 1,
32 40 'showTitle' => 1,
@@ -38,9 +46,10 @@
38 46 self::getAdditionalInformationFields()
39 47 ),
40 48 'settings' => []
41 49 ]
42 - ];
50 + ]
51 + );
43 52 }
44 53
45 54 /**
46 55 * Get contact information fields
@@ -64,9 +73,9 @@
64 73 {
65 74 return [
66 75 // Homeowner Name
67 76 [
68 - 'id' => 0,
77 + 'id' => 1,
69 78 'fieldIndex' => 1,
70 79 'type' => 'name',
71 80 'label' => BackendStrings::getTemplateStrings()['homeowner_name'],
72 81 'parentId' => null,
@@ -77,14 +86,14 @@
77 86 'position' => 1,
78 87 ],
79 88 // First Name - Child of Name Field
80 89 [
81 - 'id' => 0,
90 + 'id' => 2,
82 91 'type' => 'text',
83 92 'label' => BackendStrings::getNewFormStrings()['first_name'],
84 93 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_name'],
85 94 'required' => true,
86 - 'parentId' => 0,
95 + 'parentId' => 1,
87 96 'fieldIndex' => 1,
88 97 'defaultValue' => '',
89 98 'position' => 1,
90 99 'optionHide' => false,
@@ -92,14 +101,14 @@
92 101 'settings' => json_encode(['nameFieldType' => 'nameField1']),
93 102 ],
94 103 // Last Name - Child of Name Field
95 104 [
96 - 'id' => 0,
105 + 'id' => 3,
97 106 'type' => 'text',
98 107 'label' => BackendStrings::getNewFormStrings()['last_name'],
99 108 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
100 109 'required' => true,
101 - 'parentId' => 0,
110 + 'parentId' => 1,
102 111 'fieldIndex' => 1,
103 112 'defaultValue' => '',
104 113 'position' => 2,
105 114 'optionHide' => false,
@@ -107,9 +116,9 @@
107 116 'settings' => json_encode(['nameFieldType' => 'nameField2']),
108 117 ],
109 118 // Email Address
110 119 [
111 - 'id' => 0,
120 + 'id' => 4,
112 121 'fieldIndex' => 2,
113 122 'type' => 'email',
114 123 'label' => BackendStrings::getTemplateStrings()['email_address'],
115 124 'placeholder' => '[email protected]',
@@ -123,9 +132,9 @@
123 132 ],
124 133 ],
125 134 // Contact Number
126 135 [
127 - 'id' => 0,
136 + 'id' => 5,
128 137 'fieldIndex' => 3,
129 138 'type' => 'phone',
130 139 'label' => BackendStrings::getTemplateStrings()['contact_number'],
131 140 'placeholder' => '+1 (_) _-_',
@@ -147,9 +156,9 @@
147 156 {
148 157 return [
149 158 // Project Address - Parent
150 159 [
151 - 'id' => 0,
160 + 'id' => 6,
152 161 'fieldIndex' => 4,
153 162 'type' => 'address',
154 163 'label' => BackendStrings::getTemplateStrings()['project_address'],
155 164 'placeholder' => '',
@@ -160,14 +169,14 @@
160 169 'position' => 4,
161 170 ],
162 171 // Address Line 1 - Child of Address Field
163 172 [
164 - 'id' => 0,
173 + 'id' => 8,
165 174 'type' => 'text',
166 175 'label' => BackendStrings::getTemplateStrings()['address_line_1'],
167 176 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_1'],
168 177 'required' => true,
169 - 'parentId' => 0,
178 + 'parentId' => 4,
170 179 'fieldIndex' => 4,
171 180 'defaultValue' => '',
172 181 'position' => 1,
173 182 'hideLabel' => false,
@@ -172,9 +181,10 @@
172 181 'position' => 1,
173 182 'hideLabel' => false,
174 183 'description' => '',
175 184 'addressType' => 'streetAddress',
176 - 'settings' => json_encode([
185 + 'settings' => json_encode(
186 + [
177 187 'type' => 'streetAddress',
178 188 'hideLabel' => false,
179 189 'description' => '',
180 190 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_1'],
@@ -179,18 +189,19 @@
179 189 'description' => '',
180 190 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_1'],
181 191 'requiredMessage' => '',
182 192 'visible' => true,
183 - ]),
193 + ]
194 + ),
184 195 ],
185 196 // Address Line 2 - Child of Address Field
186 197 [
187 - 'id' => 0,
198 + 'id' => 10,
188 199 'type' => 'text',
189 200 'label' => BackendStrings::getTemplateStrings()['address_line_2'],
190 201 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_2'],
191 202 'required' => false,
192 - 'parentId' => 0,
203 + 'parentId' => 4,
193 204 'fieldIndex' => 4,
194 205 'defaultValue' => '',
195 206 'position' => 2,
196 207 'hideLabel' => false,
@@ -195,9 +206,10 @@
195 206 'position' => 2,
196 207 'hideLabel' => false,
197 208 'description' => '',
198 209 'addressType' => 'addressLine2',
199 - 'settings' => json_encode([
210 + 'settings' => json_encode(
211 + [
200 212 'type' => 'addressLine2',
201 213 'hideLabel' => false,
202 214 'description' => '',
203 215 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_2'],
@@ -202,18 +214,19 @@
202 214 'description' => '',
203 215 'placeholder' => BackendStrings::getTemplateStrings()['enter_address_line_2'],
204 216 'requiredMessage' => '',
205 217 'visible' => true,
206 - ]),
218 + ]
219 + ),
207 220 ],
208 221 // City - Child of Address Field
209 222 [
210 - 'id' => 0,
223 + 'id' => 12,
211 224 'type' => 'text',
212 225 'label' => BackendStrings::getTemplateStrings()['city'],
213 226 'placeholder' => '',
214 227 'required' => true,
215 - 'parentId' => 0,
228 + 'parentId' => 4,
216 229 'fieldIndex' => 4,
217 230 'defaultValue' => '',
218 231 'position' => 3,
219 232 'hideLabel' => false,
@@ -218,9 +231,10 @@
218 231 'position' => 3,
219 232 'hideLabel' => false,
220 233 'description' => '',
221 234 'addressType' => 'city',
222 - 'settings' => json_encode([
235 + 'settings' => json_encode(
236 + [
223 237 'type' => 'city',
224 238 'hideLabel' => false,
225 239 'description' => '',
226 240 'placeholder' => BackendStrings::getTemplateStrings()['city'],
@@ -225,18 +239,19 @@
225 239 'description' => '',
226 240 'placeholder' => BackendStrings::getTemplateStrings()['city'],
227 241 'requiredMessage' => '',
228 242 'visible' => true,
229 - ]),
243 + ]
244 + ),
230 245 ],
231 246 // State/Province - Child of Address Field
232 247 [
233 - 'id' => 0,
248 + 'id' => 14,
234 249 'type' => 'text',
235 250 'label' => BackendStrings::getTemplateStrings()['state_province'],
236 251 'placeholder' => '',
237 252 'required' => true,
238 - 'parentId' => 0,
253 + 'parentId' => 4,
239 254 'fieldIndex' => 4,
240 255 'defaultValue' => '',
241 256 'position' => 4,
242 257 'hideLabel' => false,
@@ -241,9 +256,10 @@
241 256 'position' => 4,
242 257 'hideLabel' => false,
243 258 'description' => '',
244 259 'addressType' => 'state',
245 - 'settings' => json_encode([
260 + 'settings' => json_encode(
261 + [
246 262 'type' => 'state',
247 263 'hideLabel' => false,
248 264 'description' => '',
249 265 'placeholder' => BackendStrings::getTemplateStrings()['state'],
@@ -248,18 +264,19 @@
248 264 'description' => '',
249 265 'placeholder' => BackendStrings::getTemplateStrings()['state'],
250 266 'requiredMessage' => '',
251 267 'visible' => true,
252 - ]),
268 + ]
269 + ),
253 270 ],
254 271 // Zip/Postal Code - Child of Address Field
255 272 [
256 - 'id' => 0,
273 + 'id' => 16,
257 274 'type' => 'text',
258 275 'label' => BackendStrings::getTemplateStrings()['zip_postal_code'],
259 276 'placeholder' => '',
260 277 'required' => true,
261 - 'parentId' => 0,
278 + 'parentId' => 4,
262 279 'fieldIndex' => 4,
263 280 'defaultValue' => '',
264 281 'position' => 5,
265 282 'hideLabel' => false,
@@ -264,9 +281,10 @@
264 281 'position' => 5,
265 282 'hideLabel' => false,
266 283 'description' => '',
267 284 'addressType' => 'zip',
268 - 'settings' => json_encode([
285 + 'settings' => json_encode(
286 + [
269 287 'type' => 'zip',
270 288 'hideLabel' => false,
271 289 'description' => '',
272 290 'placeholder' => BackendStrings::getTemplateStrings()['zip'],
@@ -271,18 +289,19 @@
271 289 'description' => '',
272 290 'placeholder' => BackendStrings::getTemplateStrings()['zip'],
273 291 'requiredMessage' => '',
274 292 'visible' => true,
275 - ]),
293 + ]
294 + ),
276 295 ],
277 296 // Country - Child of Address Field
278 297 [
279 - 'id' => 0,
298 + 'id' => 18,
280 299 'type' => 'text',
281 300 'label' => BackendStrings::getTemplateStrings()['country'],
282 301 'placeholder' => BackendStrings::getTemplateStrings()['select_country'],
283 302 'required' => true,
284 - 'parentId' => 0,
303 + 'parentId' => 4,
285 304 'fieldIndex' => 4,
286 305 'defaultValue' => '',
287 306 'position' => 6,
288 307 'hideLabel' => false,
@@ -287,9 +306,10 @@
287 306 'position' => 6,
288 307 'hideLabel' => false,
289 308 'description' => '',
290 309 'addressType' => 'country',
291 - 'settings' => json_encode([
310 + 'settings' => json_encode(
311 + [
292 312 'type' => 'country',
293 313 'hideLabel' => false,
294 314 'description' => '',
295 315 'placeholder' => BackendStrings::getTemplateStrings()['select_country'],
@@ -294,9 +314,10 @@
294 314 'description' => '',
295 315 'placeholder' => BackendStrings::getTemplateStrings()['select_country'],
296 316 'requiredMessage' => '',
297 317 'visible' => true,
298 - ]),
318 + ]
319 + ),
299 320 ],
300 321 ];
301 322 }
302 323
@@ -309,9 +330,9 @@
309 330 {
310 331 return [
311 332 // Change Request Date
312 333 [
313 - 'id' => 0,
334 + 'id' => 19,
314 335 'fieldIndex' => 5,
315 336 'type' => 'date',
316 337 'label' => BackendStrings::getTemplateStrings()['change_request_date'],
317 338 'placeholder' => BackendStrings::getTemplateStrings()['select_change_request_date'],
@@ -321,9 +342,9 @@
321 342 'position' => 5,
322 343 ],
323 344 // Upgrade Type Dropdown
324 345 [
325 - 'id' => 0,
346 + 'id' => 27,
326 347 'fieldIndex' => 6,
327 348 'type' => 'select',
328 349 'label' => BackendStrings::getTemplateStrings()['upgrade_type'],
329 350 'placeholder' => BackendStrings::getTemplateStrings()['select_upgrade_type'],
@@ -332,9 +353,9 @@
332 353 'defaultValue' => '',
333 354 'position' => 6,
334 355 'fieldOptions' => [
335 356 [
336 - 'id' => 0,
357 + 'id' => 20,
337 358 'label' => BackendStrings::getTemplateStrings()['cabinets'],
338 359 'value' => 'cabinets',
339 360 'isDefault' => false,
340 361 'position' => 1,
@@ -339,9 +360,9 @@
339 360 'isDefault' => false,
340 361 'position' => 1,
341 362 ],
342 363 [
343 - 'id' => 0,
364 + 'id' => 21,
344 365 'label' => BackendStrings::getTemplateStrings()['countertops'],
345 366 'value' => 'countertops',
346 367 'isDefault' => false,
347 368 'position' => 2,
@@ -346,9 +367,9 @@
346 367 'isDefault' => false,
347 368 'position' => 2,
348 369 ],
349 370 [
350 - 'id' => 0,
371 + 'id' => 22,
351 372 'label' => BackendStrings::getTemplateStrings()['appliances'],
352 373 'value' => 'appliances',
353 374 'isDefault' => false,
354 375 'position' => 3,
@@ -353,9 +374,9 @@
353 374 'isDefault' => false,
354 375 'position' => 3,
355 376 ],
356 377 [
357 - 'id' => 0,
378 + 'id' => 23,
358 379 'label' => BackendStrings::getTemplateStrings()['flooring'],
359 380 'value' => 'flooring',
360 381 'isDefault' => false,
361 382 'position' => 4,
@@ -360,9 +381,9 @@
360 381 'isDefault' => false,
361 382 'position' => 4,
362 383 ],
363 384 [
364 - 'id' => 0,
385 + 'id' => 24,
365 386 'label' => BackendStrings::getTemplateStrings()['lighting'],
366 387 'value' => 'lighting',
367 388 'isDefault' => false,
368 389 'position' => 5,
@@ -367,9 +388,9 @@
367 388 'isDefault' => false,
368 389 'position' => 5,
369 390 ],
370 391 [
371 - 'id' => 0,
392 + 'id' => 25,
372 393 'label' => BackendStrings::getTemplateStrings()['plumbing'],
373 394 'value' => 'plumbing',
374 395 'isDefault' => false,
375 396 'position' => 6,
@@ -374,9 +395,9 @@
374 395 'isDefault' => false,
375 396 'position' => 6,
376 397 ],
377 398 [
378 - 'id' => 0,
399 + 'id' => 26,
379 400 'label' => BackendStrings::getTemplateStrings()['other'],
380 401 'value' => 'other',
381 402 'isDefault' => false,
382 403 'position' => 7,
@@ -384,9 +405,9 @@
384 405 ],
385 406 ],
386 407 // Description of Change
387 408 [
388 - 'id' => 0,
409 + 'id' => 28,
389 410 'fieldIndex' => 7,
390 411 'type' => 'textarea',
391 412 'label' => BackendStrings::getTemplateStrings()['description_of_change'],
392 413 'placeholder' => BackendStrings::getTemplateStrings()['describe_the_change_requested'],
@@ -397,9 +418,9 @@
397 418 'rows' => 4,
398 419 ],
399 420 // Estimated Cost
400 421 [
401 - 'id' => 0,
422 + 'id' => 29,
402 423 'fieldIndex' => 8,
403 424 'type' => 'number',
404 425 'label' => BackendStrings::getTemplateStrings()['estimated_cost'],
405 426 'placeholder' => BackendStrings::getTemplateStrings()['enter_estimated_cost'],
@@ -420,9 +441,9 @@
420 441 {
421 442 return [
422 443 // Requires Designer Approval? Radio
423 444 [
424 - 'id' => 0,
445 + 'id' => 32,
425 446 'fieldIndex' => 9,
426 447 'type' => 'radio',
427 448 'label' => BackendStrings::getTemplateStrings()['requires_designer_approval'],
428 449 'placeholder' => '',
@@ -431,9 +452,9 @@
431 452 'defaultValue' => '',
432 453 'position' => 9,
433 454 'fieldOptions' => [
434 455 [
435 - 'id' => 0,
456 + 'id' => 30,
436 457 'label' => BackendStrings::getTemplateStrings()['yes'],
437 458 'value' => 'yes',
438 459 'isDefault' => false,
439 460 'position' => 1,
@@ -438,9 +459,9 @@
438 459 'isDefault' => false,
439 460 'position' => 1,
440 461 ],
441 462 [
442 - 'id' => 0,
463 + 'id' => 31,
443 464 'label' => BackendStrings::getTemplateStrings()['no'],
444 465 'value' => 'no',
445 466 'isDefault' => false,
446 467 'position' => 2,
@@ -448,9 +469,9 @@
448 469 ],
449 470 ],
450 471 // Additional Notes / Instructions
451 472 [
452 - 'id' => 0,
473 + 'id' => 33,
453 474 'fieldIndex' => 10,
454 475 'type' => 'textarea',
455 476 'label' => BackendStrings::getTemplateStrings()['additional_notes_instructions'],
456 477 'placeholder' => BackendStrings::getTemplateStrings()['enter_additional_notes_instructions'],