PluginProbe
The Innovative Form Builder – IvyForms / 1.0
The Innovative Form Builder – IvyForms v1.0
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 1.0, at backend/src/Services/Template/ConferenceRegistrationFormTemplate.php

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