| 1 |
<?php |
| 2 |
|
| 3 |
namespace IvyForms\Services\Template; |
| 4 |
|
| 5 |
use IvyForms\Services\Translations\BackendStrings; |
| 6 |
|
| 7 |
class DestinationWeddingRSVPFormTemplate |
| 8 |
{ |
| 9 |
/** |
| 10 |
* Destination Wedding RSVP Form Template |
| 11 |
*/ |
| 12 |
/** |
| 13 |
* Get template metadata (without form_data) |
| 14 |
* |
| 15 |
* @return array<string, mixed> |
| 16 |
*/ |
| 17 |
public static function getTemplateMeta(): array |
| 18 |
{ |
| 19 |
return [ |
| 20 |
'id' => 'destination_wedding_rsvp_form', |
| 21 |
'name' => BackendStrings::getTemplateStrings()['destination_wedding_rsvp_form'], |
| 22 |
'description' => BackendStrings::getTemplateStrings()[ |
| 23 |
'destination_wedding_rsvp_form_description' |
| 24 |
], |
| 25 |
'category' => 'event-registration-forms', |
| 26 |
'subcategory' => 'wedding-forms', |
| 27 |
'is_pro' => false, |
| 28 |
'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'destination-wedding-rsvp-form.svg' |
| 29 |
]; |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Get the full template including form data |
| 34 |
* |
| 35 |
* @return array<string, mixed> |
| 36 |
*/ |
| 37 |
public static function getTemplate(): array |
| 38 |
{ |
| 39 |
return array_merge( |
| 40 |
self::getTemplateMeta(), |
| 41 |
[ |
| 42 |
'form_data' => [ |
| 43 |
'name' => BackendStrings::getTemplateStrings()['destination_wedding_rsvp_form'], |
| 44 |
'published' => 1, |
| 45 |
'showTitle' => 1, |
| 46 |
'storeEntries' => 1, |
| 47 |
'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(), |
| 48 |
'fields' => array_merge( |
| 49 |
self::getPersonalInformationFields(), |
| 50 |
self::getAttendanceFields(), |
| 51 |
self::getMealPreferencesFields(), |
| 52 |
self::getTravelInformationFields(), |
| 53 |
self::getAdditionalInformationFields() |
| 54 |
), |
| 55 |
'settings' => [] |
| 56 |
] |
| 57 |
] |
| 58 |
); |
| 59 |
} |
| 60 |
|
| 61 |
/** |
| 62 |
* Personal information fields (name, email, phone, relationship) |
| 63 |
* |
| 64 |
* @return array<int, array<string, mixed>> |
| 65 |
*/ |
| 66 |
private static function getPersonalInformationFields(): array |
| 67 |
{ |
| 68 |
return [ |
| 69 |
// Full Name |
| 70 |
[ |
| 71 |
'id' => 1, |
| 72 |
'fieldIndex' => 1, |
| 73 |
'type' => 'name', |
| 74 |
'label' => BackendStrings::getTemplateStrings()['full_name'], |
| 75 |
'parentId' => null, |
| 76 |
'defaultValue' => '', |
| 77 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_your_full_name'], |
| 78 |
'required' => true, |
| 79 |
'readonly' => false, |
| 80 |
'position' => 1, |
| 81 |
], |
| 82 |
// First Name - Child of Name Field |
| 83 |
[ |
| 84 |
'id' => 2, |
| 85 |
'type' => 'text', |
| 86 |
'label' => BackendStrings::getTemplateStrings()['first_name'], |
| 87 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'], |
| 88 |
'required' => true, |
| 89 |
'parentId' => 1, |
| 90 |
'fieldIndex' => 1, |
| 91 |
'defaultValue' => '', |
| 92 |
'position' => 1, |
| 93 |
'optionHide' => false, |
| 94 |
'description' => '', |
| 95 |
'settings' => json_encode(['nameFieldType' => 'nameField1']), |
| 96 |
], |
| 97 |
// Last Name - Child of Name Field |
| 98 |
[ |
| 99 |
'id' => 3, |
| 100 |
'type' => 'text', |
| 101 |
'label' => BackendStrings::getTemplateStrings()['last_name'], |
| 102 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'], |
| 103 |
'required' => true, |
| 104 |
'parentId' => 1, |
| 105 |
'fieldIndex' => 1, |
| 106 |
'defaultValue' => '', |
| 107 |
'position' => 2, |
| 108 |
'optionHide' => false, |
| 109 |
'description' => '', |
| 110 |
'settings' => json_encode(['nameFieldType' => 'nameField2']), |
| 111 |
], |
| 112 |
// Email Address |
| 113 |
[ |
| 114 |
'id' => 4, |
| 115 |
'fieldIndex' => 2, |
| 116 |
'type' => 'email', |
| 117 |
'label' => BackendStrings::getTemplateStrings()['email_address'], |
| 118 |
'placeholder' => BackendStrings::getTemplateStrings()['email_placeholder'], |
| 119 |
'required' => true, |
| 120 |
'parentId' => null, |
| 121 |
'defaultValue' => '', |
| 122 |
'position' => 3, |
| 123 |
], |
| 124 |
// Phone Number |
| 125 |
[ |
| 126 |
'id' => 5, |
| 127 |
'fieldIndex' => 3, |
| 128 |
'type' => 'phone', |
| 129 |
'label' => BackendStrings::getTemplateStrings()['phone_number'], |
| 130 |
'placeholder' => BackendStrings::getTemplateStrings()['phone_placeholder'], |
| 131 |
'required' => false, |
| 132 |
'parentId' => null, |
| 133 |
'defaultValue' => '', |
| 134 |
'position' => 4, |
| 135 |
], |
| 136 |
// Relationship to Couple |
| 137 |
[ |
| 138 |
'id' => 10, |
| 139 |
'fieldIndex' => 4, |
| 140 |
'type' => 'select', |
| 141 |
'label' => BackendStrings::getTemplateStrings()['relationship_to_couple'], |
| 142 |
'placeholder' => BackendStrings::getTemplateStrings()['select_relationship_to_couple'], |
| 143 |
'required' => true, |
| 144 |
'parentId' => null, |
| 145 |
'defaultValue' => '', |
| 146 |
'position' => 5, |
| 147 |
'fieldOptions' => [ |
| 148 |
[ |
| 149 |
'id' => 6, |
| 150 |
'label' => BackendStrings::getTemplateStrings()['family'], |
| 151 |
'value' => 'family', |
| 152 |
'isDefault' => false, |
| 153 |
'position' => 1 |
| 154 |
], |
| 155 |
[ |
| 156 |
'id' => 7, |
| 157 |
'label' => BackendStrings::getTemplateStrings()['friend'], |
| 158 |
'value' => 'friend', |
| 159 |
'isDefault' => false, |
| 160 |
'position' => 2 |
| 161 |
], |
| 162 |
[ |
| 163 |
'id' => 8, |
| 164 |
'label' => BackendStrings::getTemplateStrings()['colleague'], |
| 165 |
'value' => 'colleague', |
| 166 |
'isDefault' => false, |
| 167 |
'position' => 3 |
| 168 |
], |
| 169 |
[ |
| 170 |
'id' => 9, |
| 171 |
'label' => BackendStrings::getTemplateStrings()['other'], |
| 172 |
'value' => 'other', |
| 173 |
'isDefault' => false, |
| 174 |
'position' => 4 |
| 175 |
], |
| 176 |
] |
| 177 |
], |
| 178 |
]; |
| 179 |
} |
| 180 |
|
| 181 |
/** |
| 182 |
* Attendance fields (will you attend, number of guests) |
| 183 |
* |
| 184 |
* @return array<int, array<string, mixed>> |
| 185 |
*/ |
| 186 |
private static function getAttendanceFields(): array |
| 187 |
{ |
| 188 |
return [ |
| 189 |
// Will you attend? |
| 190 |
[ |
| 191 |
'id' => 13, |
| 192 |
'fieldIndex' => 5, |
| 193 |
'type' => 'radio', |
| 194 |
'label' => BackendStrings::getTemplateStrings()['will_you_attend'], |
| 195 |
'placeholder' => '', |
| 196 |
'required' => true, |
| 197 |
'parentId' => null, |
| 198 |
'defaultValue' => '', |
| 199 |
'position' => 6, |
| 200 |
'fieldOptions' => [ |
| 201 |
[ |
| 202 |
'id' => 11, |
| 203 |
'label' => BackendStrings::getTemplateStrings()['yes'], |
| 204 |
'value' => 'yes', |
| 205 |
'isDefault' => false, |
| 206 |
'position' => 1 |
| 207 |
], |
| 208 |
[ |
| 209 |
'id' => 12, |
| 210 |
'label' => BackendStrings::getTemplateStrings()['no'], |
| 211 |
'value' => 'no', |
| 212 |
'isDefault' => false, |
| 213 |
'position' => 2 |
| 214 |
], |
| 215 |
] |
| 216 |
], |
| 217 |
// Number of Guests |
| 218 |
[ |
| 219 |
'id' => 14, |
| 220 |
'fieldIndex' => 6, |
| 221 |
'type' => 'number', |
| 222 |
'label' => BackendStrings::getTemplateStrings()['number_of_guests'], |
| 223 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_number_of_attendees'], |
| 224 |
'required' => true, |
| 225 |
'parentId' => null, |
| 226 |
'defaultValue' => '', |
| 227 |
'position' => 7, |
| 228 |
'minValue' => 1, |
| 229 |
], |
| 230 |
]; |
| 231 |
} |
| 232 |
|
| 233 |
/** |
| 234 |
* Meal preferences fields (meal preference, dietary restrictions) |
| 235 |
* |
| 236 |
* @return array<int, array<string, mixed>> |
| 237 |
*/ |
| 238 |
private static function getMealPreferencesFields(): array |
| 239 |
{ |
| 240 |
return [ |
| 241 |
// Meal Preference |
| 242 |
[ |
| 243 |
'id' => 21, |
| 244 |
'fieldIndex' => 7, |
| 245 |
'type' => 'select', |
| 246 |
'label' => BackendStrings::getTemplateStrings()['meal_preference'], |
| 247 |
'placeholder' => BackendStrings::getTemplateStrings()['select_meal_preference'], |
| 248 |
'required' => true, |
| 249 |
'parentId' => null, |
| 250 |
'defaultValue' => '', |
| 251 |
'position' => 8, |
| 252 |
'fieldOptions' => [ |
| 253 |
[ |
| 254 |
'id' => 15, |
| 255 |
'label' => BackendStrings::getTemplateStrings()['beef'], |
| 256 |
'value' => 'beef', |
| 257 |
'isDefault' => false, |
| 258 |
'position' => 1 |
| 259 |
], |
| 260 |
[ |
| 261 |
'id' => 16, |
| 262 |
'label' => BackendStrings::getTemplateStrings()['chicken'], |
| 263 |
'value' => 'chicken', |
| 264 |
'isDefault' => false, |
| 265 |
'position' => 2 |
| 266 |
], |
| 267 |
[ |
| 268 |
'id' => 17, |
| 269 |
'label' => BackendStrings::getTemplateStrings()['fish'], |
| 270 |
'value' => 'fish', |
| 271 |
'isDefault' => false, |
| 272 |
'position' => 3 |
| 273 |
], |
| 274 |
[ |
| 275 |
'id' => 18, |
| 276 |
'label' => BackendStrings::getTemplateStrings()['vegetarian'], |
| 277 |
'value' => 'vegetarian', |
| 278 |
'isDefault' => false, |
| 279 |
'position' => 4 |
| 280 |
], |
| 281 |
[ |
| 282 |
'id' => 19, |
| 283 |
'label' => BackendStrings::getTemplateStrings()['vegan'], |
| 284 |
'value' => 'vegan', |
| 285 |
'isDefault' => false, |
| 286 |
'position' => 5 |
| 287 |
], |
| 288 |
[ |
| 289 |
'id' => 20, |
| 290 |
'label' => BackendStrings::getTemplateStrings()['other'], |
| 291 |
'value' => 'other', |
| 292 |
'isDefault' => false, |
| 293 |
'position' => 6 |
| 294 |
], |
| 295 |
] |
| 296 |
], |
| 297 |
// Dietary Restrictions or Notes |
| 298 |
[ |
| 299 |
'id' => 22, |
| 300 |
'fieldIndex' => 8, |
| 301 |
'type' => 'textarea', |
| 302 |
'label' => BackendStrings::getTemplateStrings()['dietary_restrictions_or_notes'], |
| 303 |
'placeholder' => BackendStrings::getTemplateStrings()['specify_allergies_or_special_requests'], |
| 304 |
'required' => false, |
| 305 |
'parentId' => null, |
| 306 |
'defaultValue' => '', |
| 307 |
'position' => 9, |
| 308 |
], |
| 309 |
]; |
| 310 |
} |
| 311 |
|
| 312 |
/** |
| 313 |
* Travel information fields (accommodation, arrival date, departure date) |
| 314 |
* |
| 315 |
* @return array<int, array<string, mixed>> |
| 316 |
*/ |
| 317 |
private static function getTravelInformationFields(): array |
| 318 |
{ |
| 319 |
return [ |
| 320 |
// Accommodation Requirements |
| 321 |
[ |
| 322 |
'id' => 23, |
| 323 |
'fieldIndex' => 9, |
| 324 |
'type' => 'text', |
| 325 |
'label' => BackendStrings::getTemplateStrings()['accommodation_requirements'], |
| 326 |
'placeholder' => BackendStrings::getTemplateStrings()['accommodation_requirements_placeholder'], |
| 327 |
'required' => false, |
| 328 |
'parentId' => null, |
| 329 |
'defaultValue' => '', |
| 330 |
'position' => 10, |
| 331 |
], |
| 332 |
// Arrival Date |
| 333 |
[ |
| 334 |
'id' => 24, |
| 335 |
'fieldIndex' => 10, |
| 336 |
'type' => 'date', |
| 337 |
'label' => BackendStrings::getTemplateStrings()['arrival_date'], |
| 338 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_arrival_date'], |
| 339 |
'required' => true, |
| 340 |
'parentId' => null, |
| 341 |
'defaultValue' => '', |
| 342 |
'position' => 11, |
| 343 |
'dateFieldType' => 'picker', |
| 344 |
'dateFormat' => 'MM/DD/YYYY', |
| 345 |
], |
| 346 |
// Departure Date |
| 347 |
[ |
| 348 |
'id' => 25, |
| 349 |
'fieldIndex' => 11, |
| 350 |
'type' => 'date', |
| 351 |
'label' => BackendStrings::getTemplateStrings()['departure_date'], |
| 352 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_departure_date'], |
| 353 |
'required' => true, |
| 354 |
'parentId' => null, |
| 355 |
'defaultValue' => '', |
| 356 |
'position' => 12, |
| 357 |
'dateFieldType' => 'picker', |
| 358 |
'dateFormat' => 'MM/DD/YYYY', |
| 359 |
], |
| 360 |
]; |
| 361 |
} |
| 362 |
|
| 363 |
/** |
| 364 |
* Additional information fields (join welcome dinner, special requests) |
| 365 |
* |
| 366 |
* @return array<int, array<string, mixed>> |
| 367 |
*/ |
| 368 |
private static function getAdditionalInformationFields(): array |
| 369 |
{ |
| 370 |
return [ |
| 371 |
// Join Welcome Dinner? |
| 372 |
[ |
| 373 |
'id' => 28, |
| 374 |
'fieldIndex' => 12, |
| 375 |
'type' => 'radio', |
| 376 |
'label' => BackendStrings::getTemplateStrings()['join_welcome_dinner'], |
| 377 |
'placeholder' => '', |
| 378 |
'required' => false, |
| 379 |
'parentId' => null, |
| 380 |
'defaultValue' => '', |
| 381 |
'position' => 13, |
| 382 |
'fieldOptions' => [ |
| 383 |
[ |
| 384 |
'id' => 26, |
| 385 |
'label' => BackendStrings::getTemplateStrings()['yes'], |
| 386 |
'value' => 'yes', |
| 387 |
'isDefault' => false, |
| 388 |
'position' => 1 |
| 389 |
], |
| 390 |
[ |
| 391 |
'id' => 27, |
| 392 |
'label' => BackendStrings::getTemplateStrings()['no'], |
| 393 |
'value' => 'no', |
| 394 |
'isDefault' => false, |
| 395 |
'position' => 2 |
| 396 |
], |
| 397 |
] |
| 398 |
], |
| 399 |
// Special Requests or Messages |
| 400 |
[ |
| 401 |
'id' => 29, |
| 402 |
'fieldIndex' => 13, |
| 403 |
'type' => 'textarea', |
| 404 |
'label' => BackendStrings::getTemplateStrings()['special_requests_or_messages'], |
| 405 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_any_additional_notes'], |
| 406 |
'required' => false, |
| 407 |
'parentId' => null, |
| 408 |
'defaultValue' => '', |
| 409 |
'position' => 14, |
| 410 |
], |
| 411 |
]; |
| 412 |
} |
| 413 |
} |
| 414 |
|