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/EventRegistrationTemplate.php +64 -55 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 EventRegistrationTemplate
13 8 {
14 9 /**
15 - * Get the event registration 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' => 'event_registration',
23 18 'name' => BackendStrings::getTemplateStrings()['event_registration'],
@@ -23,9 +18,22 @@
23 18 'name' => BackendStrings::getTemplateStrings()['event_registration'],
24 19 'description' => BackendStrings::getTemplateStrings()['event_registration_desc'],
25 20 'category' => 'event-registration-forms',
26 21 'is_pro' => false,
27 - 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'event-registration.svg',
22 + 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'event-registration.svg'
23 + ];
24 + }
25 +
26 + /**
27 + * Get the full template including form data
28 + *
29 + * @return array<string, mixed>
30 + */
31 + public static function getTemplate(): array
32 + {
33 + return array_merge(
34 + self::getTemplateMeta(),
35 + [
28 36 'form_data' => [
29 37 'name' => BackendStrings::getTemplateStrings()['event_registration'],
30 38 'published' => 1,
31 39 'showTitle' => 1,
@@ -38,9 +46,10 @@
38 46 self::getAdditionalPreferencesFields()
39 47 ),
40 48 'settings' => []
41 49 ]
42 - ];
50 + ]
51 + );
43 52 }
44 53
45 54 /**
46 55 * Get personal 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' => BackendStrings::getTemplateStrings()['enter_your_email_address'],
@@ -117,9 +126,9 @@
117 126 {
118 127 return [
119 128 // Event Type
120 129 [
121 - 'id' => 0,
130 + 'id' => 10,
122 131 'fieldIndex' => 3,
123 132 'type' => 'select',
124 133 'label' => BackendStrings::getTemplateStrings()['event_type'],
125 134 'placeholder' => BackendStrings::getTemplateStrings()['select_event_type'],
@@ -128,9 +137,9 @@
128 137 'defaultValue' => '',
129 138 'position' => 3,
130 139 'fieldOptions' => [
131 140 [
132 - 'id' => 0,
141 + 'id' => 5,
133 142 'label' => BackendStrings::getTemplateStrings()['conference'],
134 143 'value' => 'conference',
135 144 'isDefault' => false,
136 145 'position' => 1
@@ -135,9 +144,9 @@
135 144 'isDefault' => false,
136 145 'position' => 1
137 146 ],
138 147 [
139 - 'id' => 0,
148 + 'id' => 6,
140 149 'label' => BackendStrings::getTemplateStrings()['workshop'],
141 150 'value' => 'workshop',
142 151 'isDefault' => false,
143 152 'position' => 2
@@ -142,9 +151,9 @@
142 151 'isDefault' => false,
143 152 'position' => 2
144 153 ],
145 154 [
146 - 'id' => 0,
155 + 'id' => 7,
147 156 'label' => BackendStrings::getTemplateStrings()['seminar'],
148 157 'value' => 'seminar',
149 158 'isDefault' => false,
150 159 'position' => 3
@@ -149,9 +158,9 @@
149 158 'isDefault' => false,
150 159 'position' => 3
151 160 ],
152 161 [
153 - 'id' => 0,
162 + 'id' => 8,
154 163 'label' => BackendStrings::getTemplateStrings()['networking_event'],
155 164 'value' => 'networking_event',
156 165 'isDefault' => false,
157 166 'position' => 4
@@ -156,9 +165,9 @@
156 165 'isDefault' => false,
157 166 'position' => 4
158 167 ],
159 168 [
160 - 'id' => 0,
169 + 'id' => 9,
161 170 'label' => BackendStrings::getTemplateStrings()['other'],
162 171 'value' => 'other',
163 172 'isDefault' => false,
164 173 'position' => 5
@@ -166,9 +175,9 @@
166 175 ]
167 176 ],
168 177 // Attendance Type
169 178 [
170 - 'id' => 0,
179 + 'id' => 14,
171 180 'fieldIndex' => 4,
172 181 'type' => 'select',
173 182 'label' => BackendStrings::getTemplateStrings()['attendance_type'],
174 183 'placeholder' => BackendStrings::getTemplateStrings()['select_attendance_type'],
@@ -177,9 +186,9 @@
177 186 'defaultValue' => '',
178 187 'position' => 4,
179 188 'fieldOptions' => [
180 189 [
181 - 'id' => 0,
190 + 'id' => 11,
182 191 'label' => BackendStrings::getTemplateStrings()['in_person'],
183 192 'value' => 'in_person',
184 193 'isDefault' => false,
185 194 'position' => 1
@@ -184,9 +193,9 @@
184 193 'isDefault' => false,
185 194 'position' => 1
186 195 ],
187 196 [
188 - 'id' => 0,
197 + 'id' => 12,
189 198 'label' => BackendStrings::getTemplateStrings()['virtual'],
190 199 'value' => 'virtual',
191 200 'isDefault' => false,
192 201 'position' => 2
@@ -191,9 +200,9 @@
191 200 'isDefault' => false,
192 201 'position' => 2
193 202 ],
194 203 [
195 - 'id' => 0,
204 + 'id' => 13,
196 205 'label' => BackendStrings::getTemplateStrings()['hybrid'],
197 206 'value' => 'hybrid',
198 207 'isDefault' => false,
199 208 'position' => 3
@@ -201,9 +210,9 @@
201 210 ]
202 211 ],
203 212 // Role / Participant Type
204 213 [
205 - 'id' => 0,
214 + 'id' => 21,
206 215 'fieldIndex' => 5,
207 216 'type' => 'select',
208 217 'label' => BackendStrings::getTemplateStrings()['role_participant_type'],
209 218 'placeholder' => BackendStrings::getTemplateStrings()['select_role'],
@@ -212,9 +221,9 @@
212 221 'defaultValue' => '',
213 222 'position' => 5,
214 223 'fieldOptions' => [
215 224 [
216 - 'id' => 0,
225 + 'id' => 15,
217 226 'label' => BackendStrings::getTemplateStrings()['volunteer'],
218 227 'value' => 'volunteer',
219 228 'isDefault' => false,
220 229 'position' => 1
@@ -219,9 +228,9 @@
219 228 'isDefault' => false,
220 229 'position' => 1
221 230 ],
222 231 [
223 - 'id' => 0,
232 + 'id' => 16,
224 233 'label' => BackendStrings::getTemplateStrings()['delegate'],
225 234 'value' => 'delegate',
226 235 'isDefault' => false,
227 236 'position' => 2
@@ -226,9 +235,9 @@
226 235 'isDefault' => false,
227 236 'position' => 2
228 237 ],
229 238 [
230 - 'id' => 0,
239 + 'id' => 17,
231 240 'label' => BackendStrings::getTemplateStrings()['partner'],
232 241 'value' => 'partner',
233 242 'isDefault' => false,
234 243 'position' => 3
@@ -233,9 +242,9 @@
233 242 'isDefault' => false,
234 243 'position' => 3
235 244 ],
236 245 [
237 - 'id' => 0,
246 + 'id' => 18,
238 247 'label' => BackendStrings::getTemplateStrings()['speaker'],
239 248 'value' => 'speaker',
240 249 'isDefault' => false,
241 250 'position' => 4
@@ -240,9 +249,9 @@
240 249 'isDefault' => false,
241 250 'position' => 4
242 251 ],
243 252 [
244 - 'id' => 0,
253 + 'id' => 19,
245 254 'label' => BackendStrings::getTemplateStrings()['attendee'],
246 255 'value' => 'attendee',
247 256 'isDefault' => false,
248 257 'position' => 5
@@ -247,9 +256,9 @@
247 256 'isDefault' => false,
248 257 'position' => 5
249 258 ],
250 259 [
251 - 'id' => 0,
260 + 'id' => 20,
252 261 'label' => BackendStrings::getTemplateStrings()['other'],
253 262 'value' => 'other',
254 263 'isDefault' => false,
255 264 'position' => 6
@@ -257,9 +266,9 @@
257 266 ]
258 267 ],
259 268 // Organization / Company Name
260 269 [
261 - 'id' => 0,
270 + 'id' => 22,
262 271 'fieldIndex' => 6,
263 272 'type' => 'text',
264 273 'label' => BackendStrings::getTemplateStrings()['organization_company_name'],
265 274 'placeholder' => '',
@@ -269,9 +278,9 @@
269 278 'position' => 6,
270 279 ],
271 280 // Job Title
272 281 [
273 - 'id' => 0,
282 + 'id' => 23,
274 283 'fieldIndex' => 7,
275 284 'type' => 'text',
276 285 'label' => BackendStrings::getTemplateStrings()['job_title'],
277 286 'placeholder' => '',
@@ -292,9 +301,9 @@
292 301 {
293 302 return [
294 303 // Session Selection
295 304 [
296 - 'id' => 0,
305 + 'id' => 26,
297 306 'fieldIndex' => 8,
298 307 'type' => 'select',
299 308 'label' => BackendStrings::getTemplateStrings()['session_selection'],
300 309 'placeholder' => BackendStrings::getTemplateStrings()['select_session'],
@@ -303,9 +312,9 @@
303 312 'defaultValue' => '',
304 313 'position' => 8,
305 314 'fieldOptions' => [
306 315 [
307 - 'id' => 0,
316 + 'id' => 24,
308 317 'label' => BackendStrings::getTemplateStrings()['morning_session'],
309 318 'value' => 'morning_session',
310 319 'isDefault' => false,
311 320 'position' => 1
@@ -310,9 +319,9 @@
310 319 'isDefault' => false,
311 320 'position' => 1
312 321 ],
313 322 [
314 - 'id' => 0,
323 + 'id' => 25,
315 324 'label' => BackendStrings::getTemplateStrings()['afternoon_session'],
316 325 'value' => 'afternoon_session',
317 326 'isDefault' => false,
318 327 'position' => 2
@@ -320,9 +329,9 @@
320 329 ]
321 330 ],
322 331 // Event Activity Selection
323 332 [
324 - 'id' => 0,
333 + 'id' => 29,
325 334 'fieldIndex' => 9,
326 335 'type' => 'select',
327 336 'label' => BackendStrings::getTemplateStrings()['event_activity_selection'],
328 337 'placeholder' => BackendStrings::getTemplateStrings()['select_event_activity'],
@@ -331,9 +340,9 @@
331 340 'defaultValue' => '',
332 341 'position' => 9,
333 342 'fieldOptions' => [
334 343 [
335 - 'id' => 0,
344 + 'id' => 27,
336 345 'label' => BackendStrings::getTemplateStrings()['networking_mixer'],
337 346 'value' => 'networking_mixer',
338 347 'isDefault' => false,
339 348 'position' => 1
@@ -338,9 +347,9 @@
338 347 'isDefault' => false,
339 348 'position' => 1
340 349 ],
341 350 [
342 - 'id' => 0,
351 + 'id' => 28,
343 352 'label' => BackendStrings::getTemplateStrings()['keynote_only'],
344 353 'value' => 'keynote_only',
345 354 'isDefault' => false,
346 355 'position' => 2
@@ -359,9 +368,9 @@
359 368 {
360 369 return [
361 370 // Meal Preference
362 371 [
363 - 'id' => 0,
372 + 'id' => 34,
364 373 'fieldIndex' => 10,
365 374 'type' => 'select',
366 375 'label' => BackendStrings::getTemplateStrings()['meal_preference'],
367 376 'placeholder' => BackendStrings::getTemplateStrings()['select_meal_preference'],
@@ -370,9 +379,9 @@
370 379 'defaultValue' => '',
371 380 'position' => 10,
372 381 'fieldOptions' => [
373 382 [
374 - 'id' => 0,
383 + 'id' => 30,
375 384 'label' => BackendStrings::getTemplateStrings()['vegetarian'],
376 385 'value' => 'vegetarian',
377 386 'isDefault' => false,
378 387 'position' => 1
@@ -377,9 +386,9 @@
377 386 'isDefault' => false,
378 387 'position' => 1
379 388 ],
380 389 [
381 - 'id' => 0,
390 + 'id' => 31,
382 391 'label' => BackendStrings::getTemplateStrings()['vegan'],
383 392 'value' => 'vegan',
384 393 'isDefault' => false,
385 394 'position' => 2
@@ -384,9 +393,9 @@
384 393 'isDefault' => false,
385 394 'position' => 2
386 395 ],
387 396 [
388 - 'id' => 0,
397 + 'id' => 32,
389 398 'label' => BackendStrings::getTemplateStrings()['gluten_free'],
390 399 'value' => 'gluten_free',
391 400 'isDefault' => false,
392 401 'position' => 3
@@ -391,9 +400,9 @@
391 400 'isDefault' => false,
392 401 'position' => 3
393 402 ],
394 403 [
395 - 'id' => 0,
404 + 'id' => 33,
396 405 'label' => BackendStrings::getTemplateStrings()['no_preference'],
397 406 'value' => 'no_preference',
398 407 'isDefault' => false,
399 408 'position' => 4
@@ -401,9 +410,9 @@
401 410 ]
402 411 ],
403 412 // T-Shirt Size
404 413 [
405 - 'id' => 0,
414 + 'id' => 41,
406 415 'fieldIndex' => 11,
407 416 'type' => 'select',
408 417 'label' => BackendStrings::getTemplateStrings()['t_shirt_size'],
409 418 'placeholder' => BackendStrings::getTemplateStrings()['select_t_shirt_size'],
@@ -412,9 +421,9 @@
412 421 'defaultValue' => '',
413 422 'position' => 11,
414 423 'fieldOptions' => [
415 424 [
416 - 'id' => 0,
425 + 'id' => 35,
417 426 'label' => BackendStrings::getTemplateStrings()['xs'],
418 427 'value' => 'xs',
419 428 'isDefault' => false,
420 429 'position' => 1
@@ -419,9 +428,9 @@
419 428 'isDefault' => false,
420 429 'position' => 1
421 430 ],
422 431 [
423 - 'id' => 0,
432 + 'id' => 36,
424 433 'label' => BackendStrings::getTemplateStrings()['s'],
425 434 'value' => 's',
426 435 'isDefault' => false,
427 436 'position' => 2
@@ -426,9 +435,9 @@
426 435 'isDefault' => false,
427 436 'position' => 2
428 437 ],
429 438 [
430 - 'id' => 0,
439 + 'id' => 37,
431 440 'label' => BackendStrings::getTemplateStrings()['m'],
432 441 'value' => 'm',
433 442 'isDefault' => false,
434 443 'position' => 3
@@ -433,9 +442,9 @@
433 442 'isDefault' => false,
434 443 'position' => 3
435 444 ],
436 445 [
437 - 'id' => 0,
446 + 'id' => 38,
438 447 'label' => BackendStrings::getTemplateStrings()['l'],
439 448 'value' => 'l',
440 449 'isDefault' => false,
441 450 'position' => 4
@@ -440,9 +449,9 @@
440 449 'isDefault' => false,
441 450 'position' => 4
442 451 ],
443 452 [
444 - 'id' => 0,
453 + 'id' => 39,
445 454 'label' => BackendStrings::getTemplateStrings()['xl'],
446 455 'value' => 'xl',
447 456 'isDefault' => false,
448 457 'position' => 5
@@ -447,9 +456,9 @@
447 456 'isDefault' => false,
448 457 'position' => 5
449 458 ],
450 459 [
451 - 'id' => 0,
460 + 'id' => 40,
452 461 'label' => BackendStrings::getTemplateStrings()['xxl'],
453 462 'value' => 'xxl',
454 463 'isDefault' => false,
455 464 'position' => 6
@@ -457,9 +466,9 @@
457 466 ]
458 467 ],
459 468 // Do you require special assistance?
460 469 [
461 - 'id' => 0,
470 + 'id' => 44,
462 471 'fieldIndex' => 12,
463 472 'type' => 'radio',
464 473 'label' => BackendStrings::getTemplateStrings()['require_special_assistance'],
465 474 'required' => false,
@@ -468,9 +477,9 @@
468 477 'placeholder' => '',
469 478 'position' => 12,
470 479 'fieldOptions' => [
471 480 [
472 - 'id' => 0,
481 + 'id' => 42,
473 482 'label' => BackendStrings::getTemplateStrings()['yes'],
474 483 'value' => 'yes',
475 484 'isDefault' => false,
476 485 'position' => 1
@@ -475,9 +484,9 @@
475 484 'isDefault' => false,
476 485 'position' => 1
477 486 ],
478 487 [
479 - 'id' => 0,
488 + 'id' => 43,
480 489 'label' => BackendStrings::getTemplateStrings()['no'],
481 490 'value' => 'no',
482 491 'isDefault' => false,
483 492 'position' => 2