PluginProbe
The Innovative Form Builder – IvyForms / 0.8.1
The Innovative Form Builder – IvyForms v0.8.1
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 0.8.1, at backend/src/Services/Template/YogaClassRegistrationFormTemplate.php

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