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