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