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