PluginProbe
The Innovative Form Builder – IvyForms / 1.1
The Innovative Form Builder – IvyForms v1.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 / TeamTshirtOrderFormTemplate.php

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

348 lines 12.3 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 TeamTshirtOrderFormTemplate
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' => 'team_tshirt_order_form',
18 'name' => BackendStrings::getTemplateStrings()['team_tshirt_order_form'],
19 'description' => BackendStrings::getTemplateStrings()['team_tshirt_order_form_desc'],
20 'category' => 'order-forms',
21 'subcategory' => 'tshirt-order-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'team-tshirt-order-form.svg'
24 ];
25 }
26
27 /**
28 * Get the full template including form data
29 *
30 * @return array<string, mixed>
31 */
32 public static function getTemplate(): array
33 {
34 return array_merge(
35 self::getTemplateMeta(),
36 [
37 'form_data' => [
38 'name' => BackendStrings::getTemplateStrings()['team_tshirt_order_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getContactInformationFields(),
45 self::getOrderDetailsFields(),
46 self::getAdditionalInformationFields()
47 ),
48 'settings' => []
49 ]
50 ]
51 );
52 }
53
54 /**
55 * Get contact information fields
56 *
57 * @return array<int, array<string, mixed>>
58 */
59 private static function getContactInformationFields(): array
60 {
61 return [
62 // Team Contact Name
63 [
64 'id' => 1,
65 'fieldIndex' => 1,
66 'type' => 'name',
67 'label' => BackendStrings::getTemplateStrings()['team_contact_name'],
68 'parentId' => null,
69 'defaultValue' => '',
70 'placeholder' => '',
71 'required' => true,
72 'readonly' => false,
73 'position' => 1,
74 ],
75 // First Name - Child of Name Field
76 [
77 'id' => 2,
78 'type' => 'text',
79 'label' => BackendStrings::getNewFormStrings()['first_name'],
80 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_name'],
81 'required' => true,
82 'parentId' => 1,
83 'fieldIndex' => 1,
84 'defaultValue' => '',
85 'position' => 1,
86 'optionHide' => false,
87 'description' => '',
88 'settings' => json_encode(['nameFieldType' => 'nameField1']),
89 ],
90 // Last Name - Child of Name Field
91 [
92 'id' => 3,
93 'type' => 'text',
94 'label' => BackendStrings::getNewFormStrings()['last_name'],
95 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
96 'required' => true,
97 'parentId' => 1,
98 'fieldIndex' => 1,
99 'defaultValue' => '',
100 'position' => 2,
101 'optionHide' => false,
102 'description' => '',
103 'settings' => json_encode(['nameFieldType' => 'nameField2']),
104 ],
105 // Email Address
106 [
107 'id' => 4,
108 'fieldIndex' => 2,
109 'type' => 'email',
110 'label' => BackendStrings::getTemplateStrings()['email_address'],
111 'placeholder' => '[email protected]',
112 'required' => true,
113 'parentId' => null,
114 'defaultValue' => '',
115 'position' => 2,
116 'validation' => [
117 'required' => true,
118 'email' => true
119 ],
120 ],
121 // Phone Number
122 [
123 'id' => 5,
124 'fieldIndex' => 3,
125 'type' => 'phone',
126 'label' => BackendStrings::getTemplateStrings()['phone_number'],
127 'placeholder' => '+1 (_) _-_',
128 'required' => false,
129 'parentId' => null,
130 'defaultValue' => '',
131 'position' => 3,
132 'phoneAutoDetect' => true,
133 ],
134 // Team Name
135 [
136 'id' => 6,
137 'fieldIndex' => 4,
138 'type' => 'text',
139 'label' => BackendStrings::getTemplateStrings()['team_name'],
140 'placeholder' => BackendStrings::getTemplateStrings()['enter_team_name'],
141 'required' => true,
142 'parentId' => null,
143 'defaultValue' => '',
144 'position' => 4,
145 ],
146 ];
147 }
148
149 /**
150 * Get order details fields
151 *
152 * @return array<int, array<string, mixed>>
153 */
154 private static function getOrderDetailsFields(): array
155 {
156 return [
157 // T-Shirt Size(s) Dropdown
158 [
159 'id' => 13,
160 'fieldIndex' => 5,
161 'type' => 'select',
162 'label' => BackendStrings::getTemplateStrings()['tshirt_sizes'],
163 'placeholder' => BackendStrings::getTemplateStrings()['select_tshirt_size'],
164 'required' => true,
165 'parentId' => null,
166 'defaultValue' => '',
167 'position' => 5,
168 'fieldOptions' => [
169 [
170 'id' => 7,
171 'label' => BackendStrings::getTemplateStrings()['xs'],
172 'value' => 'xs',
173 'isDefault' => false,
174 'position' => 1,
175 ],
176 [
177 'id' => 8,
178 'label' => BackendStrings::getTemplateStrings()['s'],
179 'value' => 's',
180 'isDefault' => false,
181 'position' => 2,
182 ],
183 [
184 'id' => 9,
185 'label' => BackendStrings::getTemplateStrings()['m'],
186 'value' => 'm',
187 'isDefault' => false,
188 'position' => 3,
189 ],
190 [
191 'id' => 10,
192 'label' => BackendStrings::getTemplateStrings()['l'],
193 'value' => 'l',
194 'isDefault' => false,
195 'position' => 4,
196 ],
197 [
198 'id' => 11,
199 'label' => BackendStrings::getTemplateStrings()['xl'],
200 'value' => 'xl',
201 'isDefault' => false,
202 'position' => 5,
203 ],
204 [
205 'id' => 12,
206 'label' => BackendStrings::getTemplateStrings()['xxl'],
207 'value' => 'xxl',
208 'isDefault' => false,
209 'position' => 6,
210 ],
211 ],
212 ],
213 // Quantity per Size
214 [
215 'id' => 14,
216 'fieldIndex' => 6,
217 'type' => 'number',
218 'label' => BackendStrings::getTemplateStrings()['quantity_per_size'],
219 'placeholder' => BackendStrings::getTemplateStrings()['enter_quantity'],
220 'required' => true,
221 'parentId' => null,
222 'defaultValue' => '',
223 'position' => 6,
224 ],
225 // Design Instructions
226 [
227 'id' => 15,
228 'fieldIndex' => 7,
229 'type' => 'textarea',
230 'label' => BackendStrings::getTemplateStrings()['design_instructions'],
231 'placeholder' => BackendStrings::getTemplateStrings()['enter_design_instructions'],
232 'required' => false,
233 'parentId' => null,
234 'defaultValue' => '',
235 'position' => 7,
236 'rows' => 4,
237 ],
238 // T-Shirt Color Dropdown
239 [
240 'id' => 22,
241 'fieldIndex' => 8,
242 'type' => 'select',
243 'label' => BackendStrings::getTemplateStrings()['tshirt_color'],
244 'placeholder' => BackendStrings::getTemplateStrings()['select_tshirt_color'],
245 'required' => true,
246 'parentId' => null,
247 'defaultValue' => '',
248 'position' => 8,
249 'fieldOptions' => [
250 [
251 'id' => 16,
252 'label' => BackendStrings::getTemplateStrings()['white'],
253 'value' => 'white',
254 'isDefault' => false,
255 'position' => 1,
256 ],
257 [
258 'id' => 17,
259 'label' => BackendStrings::getTemplateStrings()['black'],
260 'value' => 'black',
261 'isDefault' => false,
262 'position' => 2,
263 ],
264 [
265 'id' => 18,
266 'label' => BackendStrings::getTemplateStrings()['red'],
267 'value' => 'red',
268 'isDefault' => false,
269 'position' => 3,
270 ],
271 [
272 'id' => 19,
273 'label' => BackendStrings::getTemplateStrings()['blue'],
274 'value' => 'blue',
275 'isDefault' => false,
276 'position' => 4,
277 ],
278 [
279 'id' => 20,
280 'label' => BackendStrings::getTemplateStrings()['green'],
281 'value' => 'green',
282 'isDefault' => false,
283 'position' => 5,
284 ],
285 [
286 'id' => 21,
287 'label' => BackendStrings::getTemplateStrings()['custom'],
288 'value' => 'custom',
289 'isDefault' => false,
290 'position' => 6,
291 ],
292 ],
293 ],
294 ];
295 }
296
297 /**
298 * Get additional information fields
299 *
300 * @return array<int, array<string, mixed>>
301 */
302 private static function getAdditionalInformationFields(): array
303 {
304 return [
305 // Include Team Logo? Radio
306 [
307 'id' => 25,
308 'fieldIndex' => 9,
309 'type' => 'radio',
310 'label' => BackendStrings::getTemplateStrings()['include_team_logo'],
311 'placeholder' => '',
312 'required' => false,
313 'parentId' => null,
314 'defaultValue' => '',
315 'position' => 9,
316 'fieldOptions' => [
317 [
318 'id' => 23,
319 'label' => BackendStrings::getTemplateStrings()['yes'],
320 'value' => 'yes',
321 'isDefault' => false,
322 'position' => 1,
323 ],
324 [
325 'id' => 24,
326 'label' => BackendStrings::getTemplateStrings()['no'],
327 'value' => 'no',
328 'isDefault' => false,
329 'position' => 2,
330 ],
331 ],
332 ],
333 // Required Delivery Date
334 [
335 'id' => 26,
336 'fieldIndex' => 10,
337 'type' => 'date',
338 'label' => BackendStrings::getTemplateStrings()['required_delivery_date'],
339 'placeholder' => BackendStrings::getTemplateStrings()['select_required_delivery_date'],
340 'required' => true,
341 'parentId' => null,
342 'defaultValue' => '',
343 'position' => 10,
344 ],
345 ];
346 }
347 }
348