← All changes
|
backend/src/Services/Template/TechConferenceRegistrationFormTemplate.php
+255
-0
0.6.1
→
1.5
View file →
| @@ -1,0 +1,255 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace IvyForms\Services\Template; | |
| 4 | + | |
| 5 | +use IvyForms\Services\Translations\BackendStrings; | |
| 6 | + | |
| 7 | +class TechConferenceRegistrationFormTemplate | |
| 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' => 'tech_conference_registration_form', | |
| 18 | + 'name' => BackendStrings::getTemplateStrings()['tech_conference_registration_form'], | |
| 19 | + 'description' => BackendStrings::getTemplateStrings()['tech_conference_registration_form_desc'], | |
| 20 | + 'category' => 'event-registration-forms', | |
| 21 | + 'subcategory' => 'conference-registration-forms', | |
| 22 | + 'is_pro' => false, | |
| 23 | + 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'tech-conference-registration-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 | + [ | |
| 37 | + 'form_data' => [ | |
| 38 | + 'name' => BackendStrings::getTemplateStrings()['tech_conference_registration_form'], | |
| 39 | + 'published' => 1, | |
| 40 | + 'showTitle' => 1, | |
| 41 | + 'storeEntries' => 1, | |
| 42 | + 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(), | |
| 43 | + 'fields' => array_merge( | |
| 44 | + self::getParticipantInformationFields(), | |
| 45 | + self::getTechPreferencesFields(), | |
| 46 | + self::getAdditionalInformationFields() | |
| 47 | + ), | |
| 48 | + 'settings' => [] | |
| 49 | + ] | |
| 50 | + ] | |
| 51 | + ); | |
| 52 | + } | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * Get participant information fields | |
| 56 | + * | |
| 57 | + * @return array<int, array<string, mixed>> | |
| 58 | + */ | |
| 59 | + private static function getParticipantInformationFields(): array | |
| 60 | + { | |
| 61 | + return [ | |
| 62 | + // Full Name | |
| 63 | + [ | |
| 64 | + 'id' => 1, | |
| 65 | + 'fieldIndex' => 1, | |
| 66 | + 'type' => 'text', | |
| 67 | + 'label' => BackendStrings::getTemplateStrings()['full_name'], | |
| 68 | + 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_full_name'], | |
| 69 | + 'required' => true, | |
| 70 | + 'parentId' => null, | |
| 71 | + 'defaultValue' => '', | |
| 72 | + 'position' => 1, | |
| 73 | + 'validation' => [ | |
| 74 | + 'required' => true, | |
| 75 | + ], | |
| 76 | + ], | |
| 77 | + // Email Address | |
| 78 | + [ | |
| 79 | + 'id' => 2, | |
| 80 | + 'fieldIndex' => 2, | |
| 81 | + 'type' => 'email', | |
| 82 | + 'label' => BackendStrings::getTemplateStrings()['email_address'], | |
| 83 | + 'placeholder' => '[email protected]', | |
| 84 | + 'required' => true, | |
| 85 | + 'parentId' => null, | |
| 86 | + 'defaultValue' => '', | |
| 87 | + 'position' => 2, | |
| 88 | + 'validation' => [ | |
| 89 | + 'required' => true, | |
| 90 | + 'email' => true | |
| 91 | + ], | |
| 92 | + ], | |
| 93 | + // Phone Number | |
| 94 | + [ | |
| 95 | + 'id' => 3, | |
| 96 | + 'fieldIndex' => 3, | |
| 97 | + 'type' => 'phone', | |
| 98 | + 'label' => BackendStrings::getTemplateStrings()['phone_number'], | |
| 99 | + 'placeholder' => '+1 (_) _-_', | |
| 100 | + 'required' => false, | |
| 101 | + 'parentId' => null, | |
| 102 | + 'defaultValue' => '', | |
| 103 | + 'position' => 3, | |
| 104 | + 'phoneAutoDetect' => true, | |
| 105 | + ], | |
| 106 | + ]; | |
| 107 | + } | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * Get tech preferences fields | |
| 111 | + * | |
| 112 | + * @return array<int, array<string, mixed>> | |
| 113 | + */ | |
| 114 | + private static function getTechPreferencesFields(): array | |
| 115 | + { | |
| 116 | + return [ | |
| 117 | + // Conference Track Dropdown | |
| 118 | + [ | |
| 119 | + 'id' => 8, | |
| 120 | + 'fieldIndex' => 4, | |
| 121 | + 'type' => 'select', | |
| 122 | + 'label' => BackendStrings::getTemplateStrings()['conference_track'], | |
| 123 | + 'placeholder' => BackendStrings::getTemplateStrings()['select_conference_track'], | |
| 124 | + 'required' => true, | |
| 125 | + 'parentId' => null, | |
| 126 | + 'defaultValue' => '', | |
| 127 | + 'position' => 4, | |
| 128 | + 'fieldOptions' => [ | |
| 129 | + [ | |
| 130 | + 'id' => 4, | |
| 131 | + 'label' => BackendStrings::getTemplateStrings()['ai_machine_learning'], | |
| 132 | + 'value' => 'ai_machine_learning', | |
| 133 | + 'isDefault' => false, | |
| 134 | + 'position' => 1, | |
| 135 | + ], | |
| 136 | + [ | |
| 137 | + 'id' => 5, | |
| 138 | + 'label' => BackendStrings::getTemplateStrings()['software_development'], | |
| 139 | + 'value' => 'software_development', | |
| 140 | + 'isDefault' => false, | |
| 141 | + 'position' => 2, | |
| 142 | + ], | |
| 143 | + [ | |
| 144 | + 'id' => 6, | |
| 145 | + 'label' => BackendStrings::getTemplateStrings()['cybersecurity'], | |
| 146 | + 'value' => 'cybersecurity', | |
| 147 | + 'isDefault' => false, | |
| 148 | + 'position' => 3, | |
| 149 | + ], | |
| 150 | + [ | |
| 151 | + 'id' => 7, | |
| 152 | + 'label' => BackendStrings::getTemplateStrings()['cloud_computing'], | |
| 153 | + 'value' => 'cloud_computing', | |
| 154 | + 'isDefault' => false, | |
| 155 | + 'position' => 4, | |
| 156 | + ], | |
| 157 | + ], | |
| 158 | + ], | |
| 159 | + // Sessions to Attend (Checkbox) | |
| 160 | + [ | |
| 161 | + 'id' => 13, | |
| 162 | + 'fieldIndex' => 5, | |
| 163 | + 'type' => 'checkbox', | |
| 164 | + 'label' => BackendStrings::getTemplateStrings()['sessions_to_attend'], | |
| 165 | + 'placeholder' => '', | |
| 166 | + 'required' => false, | |
| 167 | + 'parentId' => null, | |
| 168 | + 'defaultValue' => '', | |
| 169 | + 'position' => 5, | |
| 170 | + 'fieldOptions' => [ | |
| 171 | + [ | |
| 172 | + 'id' => 9, | |
| 173 | + 'label' => BackendStrings::getTemplateStrings()['session_1'], | |
| 174 | + 'value' => 'session_1', | |
| 175 | + 'isDefault' => false, | |
| 176 | + 'position' => 1, | |
| 177 | + ], | |
| 178 | + [ | |
| 179 | + 'id' => 10, | |
| 180 | + 'label' => BackendStrings::getTemplateStrings()['session_2'], | |
| 181 | + 'value' => 'session_2', | |
| 182 | + 'isDefault' => false, | |
| 183 | + 'position' => 2, | |
| 184 | + ], | |
| 185 | + [ | |
| 186 | + 'id' => 11, | |
| 187 | + 'label' => BackendStrings::getTemplateStrings()['session_3'], | |
| 188 | + 'value' => 'session_3', | |
| 189 | + 'isDefault' => false, | |
| 190 | + 'position' => 3, | |
| 191 | + ], | |
| 192 | + [ | |
| 193 | + 'id' => 12, | |
| 194 | + 'label' => BackendStrings::getTemplateStrings()['session_4'], | |
| 195 | + 'value' => 'session_4', | |
| 196 | + 'isDefault' => false, | |
| 197 | + 'position' => 4, | |
| 198 | + ], | |
| 199 | + ], | |
| 200 | + ], | |
| 201 | + // Participation Type (Radio) | |
| 202 | + [ | |
| 203 | + 'id' => 16, | |
| 204 | + 'fieldIndex' => 6, | |
| 205 | + 'type' => 'radio', | |
| 206 | + 'label' => BackendStrings::getTemplateStrings()['participation_type'], | |
| 207 | + 'placeholder' => '', | |
| 208 | + 'required' => true, | |
| 209 | + 'parentId' => null, | |
| 210 | + 'defaultValue' => '', | |
| 211 | + 'position' => 6, | |
| 212 | + 'fieldOptions' => [ | |
| 213 | + [ | |
| 214 | + 'id' => 14, | |
| 215 | + 'label' => BackendStrings::getTemplateStrings()['in_person'], | |
| 216 | + 'value' => 'in_person', | |
| 217 | + 'isDefault' => false, | |
| 218 | + 'position' => 1, | |
| 219 | + ], | |
| 220 | + [ | |
| 221 | + 'id' => 15, | |
| 222 | + 'label' => BackendStrings::getTemplateStrings()['virtual'], | |
| 223 | + 'value' => 'virtual', | |
| 224 | + 'isDefault' => false, | |
| 225 | + 'position' => 2, | |
| 226 | + ], | |
| 227 | + ], | |
| 228 | + ], | |
| 229 | + ]; | |
| 230 | + } | |
| 231 | + | |
| 232 | + /** | |
| 233 | + * Get additional information fields | |
| 234 | + * | |
| 235 | + * @return array<int, array<string, mixed>> | |
| 236 | + */ | |
| 237 | + private static function getAdditionalInformationFields(): array | |
| 238 | + { | |
| 239 | + return [ | |
| 240 | + // Additional Notes | |
| 241 | + [ | |
| 242 | + 'id' => 17, | |
| 243 | + 'fieldIndex' => 7, | |
| 244 | + 'type' => 'textarea', | |
| 245 | + 'label' => BackendStrings::getTemplateStrings()['additional_notes'], | |
| 246 | + 'placeholder' => BackendStrings::getTemplateStrings()['write_additional_notes'], | |
| 247 | + 'required' => false, | |
| 248 | + 'parentId' => null, | |
| 249 | + 'defaultValue' => '', | |
| 250 | + 'position' => 7, | |
| 251 | + 'rows' => 4, | |
| 252 | + ], | |
| 253 | + ]; | |
| 254 | + } | |
| 255 | +} | |