PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
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 / YogaClassRegistrationFormTemplate.php

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

379 lines 13.8 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 YogaClassRegistrationFormTemplate
8 {
9 /**
10 * Yoga Class Registration Form Template
11 */
12 /**
13 * Get template metadata (without form_data)
14 *
15 * @return array<string, mixed>
16 */
17 public static function getTemplateMeta(): array
18 {
19 return [
20 'id' => 'yoga_class_registration_form',
21 'name' => BackendStrings::getTemplateStrings()['yoga_class_registration_form'],
22 'description' => BackendStrings::getTemplateStrings()[
23 'yoga_class_registration_form_description'
24 ],
25 'category' => 'registration-forms',
26 'subcategory' => 'class-registration-forms',
27 'is_pro' => false,
28 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'yoga-class-registration-form.svg'
29 ];
30 }
31
32 /**
33 * Get the full template including form data
34 *
35 * @return array<string, mixed>
36 */
37 public static function getTemplate(): array
38 {
39 return array_merge(
40 self::getTemplateMeta(),
41 [
42 'form_data' => [
43 'name' => BackendStrings::getTemplateStrings()['yoga_class_registration_form'],
44 'published' => 1,
45 'showTitle' => 1,
46 'storeEntries' => 1,
47 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
48 'fields' => array_merge(
49 self::getPersonalInformationFields(),
50 self::getClassDetailsFields(),
51 self::getAdditionalInformationFields()
52 ),
53 'settings' => []
54 ]
55 ]
56 );
57 }
58
59 /**
60 * Personal information fields (name, email, phone, birth date)
61 *
62 * @return array<int, array<string, mixed>>
63 */
64 private static function getPersonalInformationFields(): array
65 {
66 return [
67 // Full Name - Parent
68 [
69 'id' => 1,
70 'fieldIndex' => 1,
71 'type' => 'name',
72 'label' => BackendStrings::getTemplateStrings()['full_name'],
73 'parentId' => null,
74 'defaultValue' => '',
75 'placeholder' => '',
76 'required' => true,
77 'readonly' => false,
78 'position' => 1,
79 ],
80 // First Name - Child of Name Field
81 [
82 'id' => 2,
83 'type' => 'text',
84 'label' => BackendStrings::getTemplateStrings()['first_name'],
85 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
86 'required' => true,
87 'parentId' => 1,
88 'fieldIndex' => 1,
89 'defaultValue' => '',
90 'position' => 1,
91 'optionHide' => false,
92 'description' => '',
93 'settings' => json_encode(['nameFieldType' => 'nameField1']),
94 ],
95 // Last Name - Child of Name Field
96 [
97 'id' => 3,
98 'type' => 'text',
99 'label' => BackendStrings::getTemplateStrings()['last_name'],
100 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
101 'required' => true,
102 'parentId' => 1,
103 'fieldIndex' => 1,
104 'defaultValue' => '',
105 'position' => 2,
106 'optionHide' => false,
107 'description' => '',
108 'settings' => json_encode(['nameFieldType' => 'nameField2']),
109 ],
110 // Email Address
111 [
112 'id' => 4,
113 'fieldIndex' => 2,
114 'type' => 'email',
115 'label' => BackendStrings::getTemplateStrings()['email_address'],
116 'placeholder' => BackendStrings::getTemplateStrings()['email_placeholder'],
117 'required' => true,
118 'parentId' => null,
119 'defaultValue' => '',
120 'position' => 3,
121 ],
122 // Phone Number
123 [
124 'id' => 5,
125 'fieldIndex' => 3,
126 'type' => 'phone',
127 'label' => BackendStrings::getTemplateStrings()['phone_number'],
128 'placeholder' => BackendStrings::getTemplateStrings()['phone_placeholder'],
129 'required' => true,
130 'parentId' => null,
131 'defaultValue' => '',
132 'position' => 4,
133 ],
134 // Date of Birth
135 [
136 'id' => 6,
137 'fieldIndex' => 4,
138 'type' => 'date',
139 'label' => BackendStrings::getTemplateStrings()['date_of_birth'],
140 'placeholder' => BackendStrings::getTemplateStrings()['enter_date_of_birth'],
141 'required' => true,
142 'parentId' => null,
143 'defaultValue' => '',
144 'position' => 5,
145 'dateFieldType' => 'picker',
146 'dateFormat' => 'MM/DD/YYYY',
147 ],
148 ];
149 }
150
151 /**
152 * Class details fields (level, schedule, duration)
153 *
154 * @return array<int, array<string, mixed>>
155 */
156 private static function getClassDetailsFields(): array
157 {
158 return [
159 // Class Level
160 [
161 'id' => 10,
162 'fieldIndex' => 5,
163 'type' => 'select',
164 'label' => BackendStrings::getTemplateStrings()['class_level'],
165 'placeholder' => BackendStrings::getTemplateStrings()['select_class_level'],
166 'required' => true,
167 'parentId' => null,
168 'defaultValue' => '',
169 'position' => 6,
170 'fieldOptions' => [
171 [
172 'id' => 7,
173 'label' => BackendStrings::getTemplateStrings()['beginner'],
174 'value' => 'beginner',
175 'isDefault' => false,
176 'position' => 1
177 ],
178 [
179 'id' => 8,
180 'label' => BackendStrings::getTemplateStrings()['intermediate'],
181 'value' => 'intermediate',
182 'isDefault' => false,
183 'position' => 2
184 ],
185 [
186 'id' => 9,
187 'label' => BackendStrings::getTemplateStrings()['advanced'],
188 'value' => 'advanced',
189 'isDefault' => false,
190 'position' => 3
191 ],
192 ]
193 ],
194 // Preferred Schedule
195 [
196 'id' => 14,
197 'fieldIndex' => 6,
198 'type' => 'select',
199 'label' => BackendStrings::getTemplateStrings()['preferred_schedule'],
200 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_schedule'],
201 'required' => true,
202 'parentId' => null,
203 'defaultValue' => '',
204 'position' => 7,
205 'fieldOptions' => [
206 [
207 'id' => 11,
208 'label' => BackendStrings::getTemplateStrings()['morning'],
209 'value' => 'morning',
210 'isDefault' => false,
211 'position' => 1
212 ],
213 [
214 'id' => 12,
215 'label' => BackendStrings::getTemplateStrings()['afternoon'],
216 'value' => 'afternoon',
217 'isDefault' => false,
218 'position' => 2
219 ],
220 [
221 'id' => 13,
222 'label' => BackendStrings::getTemplateStrings()['evening'],
223 'value' => 'evening',
224 'isDefault' => false,
225 'position' => 3
226 ],
227 ]
228 ],
229 // Preferred Class Duration
230 [
231 'id' => 18,
232 'fieldIndex' => 7,
233 'type' => 'select',
234 'label' => BackendStrings::getTemplateStrings()['preferred_class_duration'],
235 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_class_duration'],
236 'required' => true,
237 'parentId' => null,
238 'defaultValue' => '',
239 'position' => 8,
240 'fieldOptions' => [
241 [
242 'id' => 15,
243 'label' => BackendStrings::getTemplateStrings()['duration_30_min'],
244 'value' => '30_min',
245 'isDefault' => false,
246 'position' => 1
247 ],
248 [
249 'id' => 16,
250 'label' => BackendStrings::getTemplateStrings()['duration_45_min'],
251 'value' => '45_min',
252 'isDefault' => false,
253 'position' => 2
254 ],
255 [
256 'id' => 17,
257 'label' => BackendStrings::getTemplateStrings()['duration_60_min'],
258 'value' => '60_min',
259 'isDefault' => false,
260 'position' => 3
261 ],
262 ]
263 ],
264 ];
265 }
266
267 /**
268 * Additional information fields (health, equipment, experience, goals, private sessions)
269 *
270 * @return array<int, array<string, mixed>>
271 */
272 private static function getAdditionalInformationFields(): array
273 {
274 return [
275 // Health Notes
276 [
277 'id' => 19,
278 'fieldIndex' => 8,
279 'type' => 'textarea',
280 'label' => BackendStrings::getTemplateStrings()['health_notes'],
281 'placeholder' => BackendStrings::getTemplateStrings()['health_notes_placeholder'],
282 'required' => false,
283 'parentId' => null,
284 'defaultValue' => '',
285 'position' => 9,
286 ],
287 // Equipment Needed
288 [
289 'id' => 23,
290 'fieldIndex' => 9,
291 'type' => 'checkbox',
292 'label' => BackendStrings::getTemplateStrings()['equipment_needed'],
293 'placeholder' => '',
294 'required' => false,
295 'parentId' => null,
296 'defaultValue' => '',
297 'position' => 10,
298 'fieldOptions' => [
299 [
300 'id' => 20,
301 'label' => BackendStrings::getTemplateStrings()['yoga_mat'],
302 'value' => 'yoga_mat',
303 'isDefault' => false,
304 'position' => 1
305 ],
306 [
307 'id' => 21,
308 'label' => BackendStrings::getTemplateStrings()['block'],
309 'value' => 'block',
310 'isDefault' => false,
311 'position' => 2
312 ],
313 [
314 'id' => 22,
315 'label' => BackendStrings::getTemplateStrings()['strap'],
316 'value' => 'strap',
317 'isDefault' => false,
318 'position' => 3
319 ],
320 ]
321 ],
322 // Previous Yoga Experience
323 [
324 'id' => 24,
325 'fieldIndex' => 10,
326 'type' => 'text',
327 'label' => BackendStrings::getTemplateStrings()['previous_yoga_experience'],
328 'placeholder' => BackendStrings::getTemplateStrings()[
329 'previous_yoga_experience_placeholder'
330 ],
331 'required' => false,
332 'parentId' => null,
333 'defaultValue' => '',
334 'position' => 11,
335 ],
336 // Motivation / Goals
337 [
338 'id' => 25,
339 'fieldIndex' => 11,
340 'type' => 'textarea',
341 'label' => BackendStrings::getTemplateStrings()['motivation_goals'],
342 'placeholder' => BackendStrings::getTemplateStrings()['motivation_goals_placeholder'],
343 'required' => false,
344 'parentId' => null,
345 'defaultValue' => '',
346 'position' => 12,
347 ],
348 // Interested in Private Sessions? (radio)
349 [
350 'id' => 28,
351 'fieldIndex' => 12,
352 'type' => 'radio',
353 'label' => BackendStrings::getTemplateStrings()['interested_private_sessions'],
354 'placeholder' => '',
355 'required' => true,
356 'parentId' => null,
357 'defaultValue' => '',
358 'position' => 13,
359 'fieldOptions' => [
360 [
361 'id' => 26,
362 'label' => BackendStrings::getTemplateStrings()['yes'],
363 'value' => 'yes',
364 'isDefault' => false,
365 'position' => 1
366 ],
367 [
368 'id' => 27,
369 'label' => BackendStrings::getTemplateStrings()['no'],
370 'value' => 'no',
371 'isDefault' => false,
372 'position' => 2
373 ],
374 ]
375 ],
376 ];
377 }
378 }
379