← All changes
|
backend/src/Services/Template/ConferenceRegistrationFormTemplate.php
+44
-35
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 ConferenceRegistrationFormTemplate |
| 13 | 8 | { |
| 14 | 9 | /** |
| 15 | - * Get the conference 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' => 'conference_registration_form', |
| 23 | 18 | 'name' => BackendStrings::getTemplateStrings()['conference_registration_form'], |
| @@ -23,9 +18,22 @@ | ||
| 23 | 18 | 'name' => BackendStrings::getTemplateStrings()['conference_registration_form'], |
| 24 | 19 | 'description' => BackendStrings::getTemplateStrings()['conference_registration_form_desc'], |
| 25 | 20 | 'category' => 'event-registration-forms', |
| 26 | 21 | 'is_pro' => false, |
| 27 | - 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'conference-registration-form.svg', | |
| 22 | + 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'conference-registration-form.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()['conference_registration_form'], |
| 30 | 38 | 'published' => 1, |
| 31 | 39 | 'showTitle' => 1, |
| @@ -39,9 +47,10 @@ | ||
| 39 | 47 | self::getNotificationsPreferencesFields() |
| 40 | 48 | ), |
| 41 | 49 | 'settings' => [] |
| 42 | 50 | ] |
| 43 | - ]; | |
| 51 | + ] | |
| 52 | + ); | |
| 44 | 53 | } |
| 45 | 54 | |
| 46 | 55 | /** |
| 47 | 56 | * Get personal information fields |
| @@ -52,9 +61,9 @@ | ||
| 52 | 61 | { |
| 53 | 62 | return [ |
| 54 | 63 | // Name Field - Parent |
| 55 | 64 | [ |
| 56 | - 'id' => 0, | |
| 65 | + 'id' => 1, | |
| 57 | 66 | 'fieldIndex' => 1, |
| 58 | 67 | 'type' => 'name', |
| 59 | 68 | 'label' => BackendStrings::getTemplateStrings()['name_first_last'], |
| 60 | 69 | 'parentId' => null, |
| @@ -65,14 +74,14 @@ | ||
| 65 | 74 | 'position' => 1, |
| 66 | 75 | ], |
| 67 | 76 | // First Name - Child of Name Field |
| 68 | 77 | [ |
| 69 | - 'id' => 0, | |
| 78 | + 'id' => 2, | |
| 70 | 79 | 'type' => 'text', |
| 71 | 80 | 'label' => BackendStrings::getNewFormStrings()['first_name'], |
| 72 | 81 | 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_full_name'], |
| 73 | 82 | 'required' => true, |
| 74 | - 'parentId' => 0, | |
| 83 | + 'parentId' => 1, | |
| 75 | 84 | 'fieldIndex' => 1, |
| 76 | 85 | 'defaultValue' => '', |
| 77 | 86 | 'position' => 1, |
| 78 | 87 | 'optionHide' => false, |
| @@ -80,14 +89,14 @@ | ||
| 80 | 89 | 'settings' => json_encode(['nameFieldType' => 'nameField1']), |
| 81 | 90 | ], |
| 82 | 91 | // Last Name - Child of Name Field |
| 83 | 92 | [ |
| 84 | - 'id' => 0, | |
| 93 | + 'id' => 3, | |
| 85 | 94 | 'type' => 'text', |
| 86 | 95 | 'label' => BackendStrings::getNewFormStrings()['last_name'], |
| 87 | 96 | 'placeholder' => '', |
| 88 | 97 | 'required' => true, |
| 89 | - 'parentId' => 0, | |
| 98 | + 'parentId' => 1, | |
| 90 | 99 | 'fieldIndex' => 1, |
| 91 | 100 | 'defaultValue' => '', |
| 92 | 101 | 'position' => 2, |
| 93 | 102 | 'optionHide' => false, |
| @@ -95,9 +104,9 @@ | ||
| 95 | 104 | 'settings' => json_encode(['nameFieldType' => 'nameField2']), |
| 96 | 105 | ], |
| 97 | 106 | // Email Address |
| 98 | 107 | [ |
| 99 | - 'id' => 0, | |
| 108 | + 'id' => 4, | |
| 100 | 109 | 'fieldIndex' => 2, |
| 101 | 110 | 'type' => 'email', |
| 102 | 111 | 'label' => BackendStrings::getTemplateStrings()['email_address'], |
| 103 | 112 | 'placeholder' => BackendStrings::getTemplateStrings()['email_address'], |
| @@ -118,9 +127,9 @@ | ||
| 118 | 127 | { |
| 119 | 128 | return [ |
| 120 | 129 | // Access Pass |
| 121 | 130 | [ |
| 122 | - 'id' => 0, | |
| 131 | + 'id' => 8, | |
| 123 | 132 | 'fieldIndex' => 3, |
| 124 | 133 | 'type' => 'select', |
| 125 | 134 | 'label' => BackendStrings::getTemplateStrings()['access_pass'], |
| 126 | 135 | 'placeholder' => BackendStrings::getTemplateStrings()['select_access_pass'], |
| @@ -129,9 +138,9 @@ | ||
| 129 | 138 | 'defaultValue' => '', |
| 130 | 139 | 'position' => 3, |
| 131 | 140 | 'fieldOptions' => [ |
| 132 | 141 | [ |
| 133 | - 'id' => 0, | |
| 142 | + 'id' => 5, | |
| 134 | 143 | 'label' => BackendStrings::getTemplateStrings()['bronze_pass'], |
| 135 | 144 | 'value' => 'bronze_199_95', |
| 136 | 145 | 'isDefault' => false, |
| 137 | 146 | 'position' => 1 |
| @@ -136,9 +145,9 @@ | ||
| 136 | 145 | 'isDefault' => false, |
| 137 | 146 | 'position' => 1 |
| 138 | 147 | ], |
| 139 | 148 | [ |
| 140 | - 'id' => 0, | |
| 149 | + 'id' => 6, | |
| 141 | 150 | 'label' => BackendStrings::getTemplateStrings()['silver_pass'], |
| 142 | 151 | 'value' => 'silver_299_95', |
| 143 | 152 | 'isDefault' => false, |
| 144 | 153 | 'position' => 2 |
| @@ -143,9 +152,9 @@ | ||
| 143 | 152 | 'isDefault' => false, |
| 144 | 153 | 'position' => 2 |
| 145 | 154 | ], |
| 146 | 155 | [ |
| 147 | - 'id' => 0, | |
| 156 | + 'id' => 7, | |
| 148 | 157 | 'label' => BackendStrings::getTemplateStrings()['gold_pass'], |
| 149 | 158 | 'value' => 'gold_399_95', |
| 150 | 159 | 'isDefault' => false, |
| 151 | 160 | 'position' => 3 |
| @@ -164,9 +173,9 @@ | ||
| 164 | 173 | { |
| 165 | 174 | return [ |
| 166 | 175 | // Sessions to Attend |
| 167 | 176 | [ |
| 168 | - 'id' => 0, | |
| 177 | + 'id' => 14, | |
| 169 | 178 | 'fieldIndex' => 4, |
| 170 | 179 | 'type' => 'checkbox', |
| 171 | 180 | 'label' => BackendStrings::getTemplateStrings()['sessions_to_attend'], |
| 172 | 181 | 'placeholder' => '', |
| @@ -175,9 +184,9 @@ | ||
| 175 | 184 | 'defaultValue' => '', |
| 176 | 185 | 'position' => 4, |
| 177 | 186 | 'fieldOptions' => [ |
| 178 | 187 | [ |
| 179 | - 'id' => 0, | |
| 188 | + 'id' => 9, | |
| 180 | 189 | 'label' => BackendStrings::getTemplateStrings()['session_1'], |
| 181 | 190 | 'value' => 'session_1', |
| 182 | 191 | 'isDefault' => false, |
| 183 | 192 | 'position' => 1 |
| @@ -182,9 +191,9 @@ | ||
| 182 | 191 | 'isDefault' => false, |
| 183 | 192 | 'position' => 1 |
| 184 | 193 | ], |
| 185 | 194 | [ |
| 186 | - 'id' => 0, | |
| 195 | + 'id' => 10, | |
| 187 | 196 | 'label' => BackendStrings::getTemplateStrings()['session_2'], |
| 188 | 197 | 'value' => 'session_2', |
| 189 | 198 | 'isDefault' => false, |
| 190 | 199 | 'position' => 2 |
| @@ -189,9 +198,9 @@ | ||
| 189 | 198 | 'isDefault' => false, |
| 190 | 199 | 'position' => 2 |
| 191 | 200 | ], |
| 192 | 201 | [ |
| 193 | - 'id' => 0, | |
| 202 | + 'id' => 11, | |
| 194 | 203 | 'label' => BackendStrings::getTemplateStrings()['session_3'], |
| 195 | 204 | 'value' => 'session_3', |
| 196 | 205 | 'isDefault' => false, |
| 197 | 206 | 'position' => 3 |
| @@ -196,9 +205,9 @@ | ||
| 196 | 205 | 'isDefault' => false, |
| 197 | 206 | 'position' => 3 |
| 198 | 207 | ], |
| 199 | 208 | [ |
| 200 | - 'id' => 0, | |
| 209 | + 'id' => 12, | |
| 201 | 210 | 'label' => BackendStrings::getTemplateStrings()['session_4'], |
| 202 | 211 | 'value' => 'session_4', |
| 203 | 212 | 'isDefault' => false, |
| 204 | 213 | 'position' => 4 |
| @@ -203,9 +212,9 @@ | ||
| 203 | 212 | 'isDefault' => false, |
| 204 | 213 | 'position' => 4 |
| 205 | 214 | ], |
| 206 | 215 | [ |
| 207 | - 'id' => 0, | |
| 216 | + 'id' => 13, | |
| 208 | 217 | 'label' => BackendStrings::getTemplateStrings()['session_5'], |
| 209 | 218 | 'value' => 'session_5', |
| 210 | 219 | 'isDefault' => false, |
| 211 | 220 | 'position' => 5 |
| @@ -213,9 +222,9 @@ | ||
| 213 | 222 | ] |
| 214 | 223 | ], |
| 215 | 224 | // Attendance Type (Radio) |
| 216 | 225 | [ |
| 217 | - 'id' => 0, | |
| 226 | + 'id' => 17, | |
| 218 | 227 | 'fieldIndex' => 5, |
| 219 | 228 | 'type' => 'radio', |
| 220 | 229 | 'label' => BackendStrings::getTemplateStrings()['attendance_type_radio'], |
| 221 | 230 | 'placeholder' => '', |
| @@ -224,9 +233,9 @@ | ||
| 224 | 233 | 'defaultValue' => '', |
| 225 | 234 | 'position' => 5, |
| 226 | 235 | 'fieldOptions' => [ |
| 227 | 236 | [ |
| 228 | - 'id' => 0, | |
| 237 | + 'id' => 15, | |
| 229 | 238 | 'label' => BackendStrings::getTemplateStrings()['in_person'], |
| 230 | 239 | 'value' => 'in_person', |
| 231 | 240 | 'isDefault' => false, |
| 232 | 241 | 'position' => 1 |
| @@ -231,9 +240,9 @@ | ||
| 231 | 240 | 'isDefault' => false, |
| 232 | 241 | 'position' => 1 |
| 233 | 242 | ], |
| 234 | 243 | [ |
| 235 | - 'id' => 0, | |
| 244 | + 'id' => 16, | |
| 236 | 245 | 'label' => BackendStrings::getTemplateStrings()['virtual'], |
| 237 | 246 | 'value' => 'virtual', |
| 238 | 247 | 'isDefault' => false, |
| 239 | 248 | 'position' => 2 |
| @@ -252,9 +261,9 @@ | ||
| 252 | 261 | { |
| 253 | 262 | return [ |
| 254 | 263 | // Will you be staying overnight? |
| 255 | 264 | [ |
| 256 | - 'id' => 0, | |
| 265 | + 'id' => 20, | |
| 257 | 266 | 'fieldIndex' => 6, |
| 258 | 267 | 'type' => 'radio', |
| 259 | 268 | 'label' => BackendStrings::getTemplateStrings()['will_you_be_staying_overnight'], |
| 260 | 269 | 'placeholder' => '', |
| @@ -263,9 +272,9 @@ | ||
| 263 | 272 | 'defaultValue' => '', |
| 264 | 273 | 'position' => 6, |
| 265 | 274 | 'fieldOptions' => [ |
| 266 | 275 | [ |
| 267 | - 'id' => 0, | |
| 276 | + 'id' => 18, | |
| 268 | 277 | 'label' => BackendStrings::getTemplateStrings()['yes'], |
| 269 | 278 | 'value' => 'yes', |
| 270 | 279 | 'isDefault' => false, |
| 271 | 280 | 'position' => 1 |
| @@ -270,9 +279,9 @@ | ||
| 270 | 279 | 'isDefault' => false, |
| 271 | 280 | 'position' => 1 |
| 272 | 281 | ], |
| 273 | 282 | [ |
| 274 | - 'id' => 0, | |
| 283 | + 'id' => 19, | |
| 275 | 284 | 'label' => BackendStrings::getTemplateStrings()['no'], |
| 276 | 285 | 'value' => 'no', |
| 277 | 286 | 'isDefault' => false, |
| 278 | 287 | 'position' => 2 |
| @@ -291,9 +300,9 @@ | ||
| 291 | 300 | { |
| 292 | 301 | return [ |
| 293 | 302 | // Email Updates for Future Conferences |
| 294 | 303 | [ |
| 295 | - 'id' => 0, | |
| 304 | + 'id' => 23, | |
| 296 | 305 | 'fieldIndex' => 7, |
| 297 | 306 | 'type' => 'radio', |
| 298 | 307 | 'label' => BackendStrings::getTemplateStrings()['email_updates_future_conferences'], |
| 299 | 308 | 'placeholder' => '', |
| @@ -302,9 +311,9 @@ | ||
| 302 | 311 | 'defaultValue' => '', |
| 303 | 312 | 'position' => 7, |
| 304 | 313 | 'fieldOptions' => [ |
| 305 | 314 | [ |
| 306 | - 'id' => 0, | |
| 315 | + 'id' => 21, | |
| 307 | 316 | 'label' => BackendStrings::getTemplateStrings()['yes'], |
| 308 | 317 | 'value' => 'yes', |
| 309 | 318 | 'isDefault' => false, |
| 310 | 319 | 'position' => 1 |
| @@ -309,9 +318,9 @@ | ||
| 309 | 318 | 'isDefault' => false, |
| 310 | 319 | 'position' => 1 |
| 311 | 320 | ], |
| 312 | 321 | [ |
| 313 | - 'id' => 0, | |
| 322 | + 'id' => 22, | |
| 314 | 323 | 'label' => BackendStrings::getTemplateStrings()['no'], |
| 315 | 324 | 'value' => 'no', |
| 316 | 325 | 'isDefault' => false, |
| 317 | 326 | 'position' => 2 |
| @@ -319,9 +328,9 @@ | ||
| 319 | 328 | ] |
| 320 | 329 | ], |
| 321 | 330 | // Comments or Questions |
| 322 | 331 | [ |
| 323 | - 'id' => 0, | |
| 332 | + 'id' => 24, | |
| 324 | 333 | 'fieldIndex' => 8, |
| 325 | 334 | 'type' => 'textarea', |
| 326 | 335 | 'label' => BackendStrings::getTemplateStrings()['comments_or_questions'], |
| 327 | 336 | 'placeholder' => BackendStrings::getTemplateStrings()['enter_special_requests_questions_comments'], |