PluginProbe
The Innovative Form Builder – IvyForms / 0.9.1
The Innovative Form Builder – IvyForms v0.9.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 / CookingClassRegistrationFormTemplate.php

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

279 lines 9.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace IvyForms\Services\Template;
6
7 // phpcs:disable PSR1.Files.SideEffects
8 if (!defined('ABSPATH')) {
9 exit; // Exit if accessed directly
10 }
11
12 use IvyForms\Services\Translations\BackendStrings;
13
14 /**
15 * Cooking Class Registration Form Template
16 */
17 class CookingClassRegistrationFormTemplate
18 {
19 /**
20 * Get the template configuration
21 *
22 * @return array<string, mixed>
23 */
24 public static function getTemplate(): array
25 {
26 return [
27 'id' => 'cooking_class_registration_form',
28 'name' => BackendStrings::getTemplateStrings()['cooking_class_registration_form'],
29 'description' => BackendStrings::getTemplateStrings()[
30 'cooking_class_registration_form_description'
31 ],
32 'category' => 'registration-forms',
33 'subcategory' => 'class-registration-forms',
34 'is_pro' => false,
35 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'cooking-class-registration-form.svg',
36 'form_data' => [
37 'name' => BackendStrings::getTemplateStrings()['cooking_class_registration_form'],
38 'published' => 1,
39 'showTitle' => 1,
40 'storeEntries' => 1,
41 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
42 'fields' => array_merge(
43 self::getPersonalInformationFields(),
44 self::getClassDetailsFields(),
45 self::getPreferencesFields(),
46 self::getAdditionalInformationFields()
47 ),
48 'settings' => []
49 ]
50 ];
51 }
52
53 /**
54 * Personal information fields (name, email, phone)
55 *
56 * @return array<int, array<string, mixed>>
57 */
58 private static function getPersonalInformationFields(): array
59 {
60 return [
61 // Full Name - Parent
62 [
63 'id' => 1,
64 'fieldIndex' => 1,
65 'type' => 'name',
66 'label' => BackendStrings::getTemplateStrings()['full_name'],
67 'parentId' => null,
68 'defaultValue' => '',
69 'placeholder' => '',
70 'required' => true,
71 'readonly' => false,
72 'position' => 1,
73 ],
74 // First Name - Child of Name Field
75 [
76 'id' => 2,
77 'type' => 'text',
78 'label' => BackendStrings::getTemplateStrings()['first_name'],
79 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
80 'required' => true,
81 'parentId' => 1,
82 'fieldIndex' => 1,
83 'defaultValue' => '',
84 'position' => 1,
85 'optionHide' => false,
86 'description' => '',
87 'settings' => json_encode(['nameFieldType' => 'nameField1']),
88 ],
89 // Last Name - Child of Name Field
90 [
91 'id' => 3,
92 'type' => 'text',
93 'label' => BackendStrings::getTemplateStrings()['last_name'],
94 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
95 'required' => true,
96 'parentId' => 1,
97 'fieldIndex' => 1,
98 'defaultValue' => '',
99 'position' => 2,
100 'optionHide' => false,
101 'description' => '',
102 'settings' => json_encode(['nameFieldType' => 'nameField2']),
103 ],
104 // Email Address
105 [
106 'id' => 4,
107 'fieldIndex' => 2,
108 'type' => 'email',
109 'label' => BackendStrings::getTemplateStrings()['email_address'],
110 'placeholder' => BackendStrings::getTemplateStrings()['email_placeholder'],
111 'required' => true,
112 'parentId' => null,
113 'defaultValue' => '',
114 'position' => 2,
115 ],
116 // Phone Number
117 [
118 'id' => 5,
119 'fieldIndex' => 3,
120 'type' => 'phone',
121 'label' => BackendStrings::getTemplateStrings()['phone_number'],
122 'placeholder' => BackendStrings::getTemplateStrings()['phone_placeholder'],
123 'required' => false,
124 'parentId' => null,
125 'defaultValue' => '',
126 'position' => 3,
127 ],
128 ];
129 }
130
131 /**
132 * Class details fields (skill level, preferred date)
133 *
134 * @return array<int, array<string, mixed>>
135 */
136 private static function getClassDetailsFields(): array
137 {
138 return [
139 // Skill Level
140 [
141 'id' => 9,
142 'fieldIndex' => 4,
143 'type' => 'select',
144 'label' => BackendStrings::getTemplateStrings()['skill_level'],
145 'placeholder' => BackendStrings::getTemplateStrings()['select_skill_level'],
146 'required' => true,
147 'parentId' => null,
148 'defaultValue' => '',
149 'position' => 4,
150 'fieldOptions' => [
151 [
152 'id' => 6,
153 'label' => BackendStrings::getTemplateStrings()['beginner'],
154 'value' => 'beginner',
155 'isDefault' => false,
156 'position' => 1
157 ],
158 [
159 'id' => 7,
160 'label' => BackendStrings::getTemplateStrings()['intermediate'],
161 'value' => 'intermediate',
162 'isDefault' => false,
163 'position' => 2
164 ],
165 [
166 'id' => 8,
167 'label' => BackendStrings::getTemplateStrings()['advanced'],
168 'value' => 'advanced',
169 'isDefault' => false,
170 'position' => 3
171 ],
172 ]
173 ],
174 // Preferred Class Date
175 [
176 'id' => 10,
177 'fieldIndex' => 5,
178 'type' => 'date',
179 'label' => BackendStrings::getTemplateStrings()['preferred_class_date'],
180 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_class_date'],
181 'required' => true,
182 'parentId' => null,
183 'defaultValue' => '',
184 'position' => 5,
185 'dateFieldType' => 'picker',
186 'dateFormat' => 'MM/DD/YYYY',
187 ],
188 ];
189 }
190
191 /**
192 * Preferences fields (favorite cuisine, dietary restrictions, equipment)
193 *
194 * @return array<int, array<string, mixed>>
195 */
196 private static function getPreferencesFields(): array
197 {
198 return [
199 // Favorite Cuisine
200 [
201 'id' => 11,
202 'fieldIndex' => 6,
203 'type' => 'text',
204 'label' => BackendStrings::getTemplateStrings()['favorite_cuisine'],
205 'placeholder' => BackendStrings::getTemplateStrings()['favorite_cuisine_placeholder'],
206 'required' => false,
207 'parentId' => null,
208 'defaultValue' => '',
209 'position' => 6,
210 ],
211 // Dietary Restrictions
212 [
213 'id' => 12,
214 'fieldIndex' => 7,
215 'type' => 'textarea',
216 'label' => BackendStrings::getTemplateStrings()['dietary_restrictions'],
217 'placeholder' => BackendStrings::getTemplateStrings()[
218 'cooking_dietary_restrictions_placeholder'
219 ],
220 'required' => false,
221 'parentId' => null,
222 'defaultValue' => '',
223 'position' => 7,
224 ],
225 // Equipment Needed
226 [
227 'id' => 15,
228 'fieldIndex' => 8,
229 'type' => 'checkbox',
230 'label' => BackendStrings::getTemplateStrings()['equipment_needed'],
231 'placeholder' => '',
232 'required' => false,
233 'parentId' => null,
234 'defaultValue' => '',
235 'position' => 8,
236 'fieldOptions' => [
237 [
238 'id' => 13,
239 'label' => BackendStrings::getTemplateStrings()['apron'],
240 'value' => 'apron',
241 'isDefault' => false,
242 'position' => 1
243 ],
244 [
245 'id' => 14,
246 'label' => BackendStrings::getTemplateStrings()['cooking_tools'],
247 'value' => 'cooking_tools',
248 'isDefault' => false,
249 'position' => 2
250 ],
251 ]
252 ],
253 ];
254 }
255
256 /**
257 * Additional information fields (motivation/goals)
258 *
259 * @return array<int, array<string, mixed>>
260 */
261 private static function getAdditionalInformationFields(): array
262 {
263 return [
264 // Motivation / Goals
265 [
266 'id' => 16,
267 'fieldIndex' => 9,
268 'type' => 'textarea',
269 'label' => BackendStrings::getTemplateStrings()['motivation_goals'],
270 'placeholder' => BackendStrings::getTemplateStrings()['motivation_goals_placeholder'],
271 'required' => false,
272 'parentId' => null,
273 'defaultValue' => '',
274 'position' => 9,
275 ],
276 ];
277 }
278 }
279