PluginProbe
The Innovative Form Builder – IvyForms / 0.6
The Innovative Form Builder – IvyForms v0.6
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Services / Template / ConferenceRegistrationFormTemplate.php

ConferenceRegistrationFormTemplate.php in The Innovative Form Builder – IvyForms 0.6, at backend/src/Services/Template/ConferenceRegistrationFormTemplate.php

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