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