PluginProbe
The Innovative Form Builder – IvyForms / 0.8.2
The Innovative Form Builder – IvyForms v0.8.2
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 / CraftVendorRegistrationFormTemplate.php

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

320 lines 11.0 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 class CraftVendorRegistrationFormTemplate
13 {
14 /**
15 * Get the craft vendor registration form template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'craft_vendor_registration_form',
23 'name' => BackendStrings::getTemplateStrings()['craft_vendor_registration_form'],
24 'description' => BackendStrings::getTemplateStrings()[
25 'craft_vendor_registration_form_desc'
26 ],
27 'category' => 'registration-forms',
28 'subcategory' => 'vendor-registration-forms',
29 'is_pro' => false,
30 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'craft-vendor-registration-form.svg',
31 'form_data' => [
32 'name' => BackendStrings::getTemplateStrings()['craft_vendor_registration_form'],
33 'published' => 1,
34 'showTitle' => 1,
35 'storeEntries' => 1,
36 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
37 'fields' => array_merge(
38 self::getVendorInformationFields(),
39 self::getProductDetailsFields(),
40 self::getBoothDetailsFields(),
41 self::getAdditionalFields()
42 ),
43 'settings' => []
44 ]
45 ];
46 }
47
48 /**
49 * Vendor information fields (business name, contact, email, phone)
50 *
51 * @return array<int, array<string, mixed>>
52 */
53 private static function getVendorInformationFields(): array
54 {
55 return [
56 // Business / Vendor Name
57 [
58 'id' => 0,
59 'fieldIndex' => 1,
60 'type' => 'text',
61 'label' => BackendStrings::getTemplateStrings()['business_vendor_name'],
62 'placeholder' => BackendStrings::getTemplateStrings()[
63 'enter_business_name'
64 ],
65 'required' => true,
66 'parentId' => null,
67 'defaultValue' => '',
68 'position' => 1,
69 ],
70 // Owner / Contact Person
71 [
72 'id' => 0,
73 'fieldIndex' => 2,
74 'type' => 'text',
75 'label' => BackendStrings::getTemplateStrings()['owner_contact_person'],
76 'placeholder' => BackendStrings::getTemplateStrings()[
77 'enter_owner_contact_name'
78 ],
79 'required' => true,
80 'parentId' => null,
81 'defaultValue' => '',
82 'position' => 2,
83 ],
84 // Email Address
85 [
86 'id' => 0,
87 'fieldIndex' => 3,
88 'type' => 'email',
89 'label' => BackendStrings::getTemplateStrings()['email_address'],
90 'placeholder' => BackendStrings::getTemplateStrings()['name_placeholder'],
91 'required' => true,
92 'parentId' => null,
93 'defaultValue' => '',
94 'position' => 3,
95 ],
96 // Phone Number
97 [
98 'id' => 0,
99 'fieldIndex' => 4,
100 'type' => 'phone',
101 'label' => BackendStrings::getTemplateStrings()['phone_number'],
102 'placeholder' => BackendStrings::getTemplateStrings()[
103 'phone_placeholder'
104 ],
105 'required' => false,
106 'parentId' => null,
107 'defaultValue' => '',
108 'position' => 4,
109 'phoneAutoDetect' => true,
110 ],
111 ];
112 }
113
114 /**
115 * Product details fields (craft type, products description)
116 *
117 * @return array<int, array<string, mixed>>
118 */
119 private static function getProductDetailsFields(): array
120 {
121 return [
122 // Craft Type
123 [
124 'id' => 0,
125 'fieldIndex' => 5,
126 'type' => 'select',
127 'label' => BackendStrings::getTemplateStrings()['craft_type'],
128 'placeholder' => BackendStrings::getTemplateStrings()[
129 'select_craft_type'
130 ],
131 'required' => true,
132 'parentId' => null,
133 'defaultValue' => '',
134 'position' => 5,
135 'fieldOptions' => [
136 [
137 'id' => 0,
138 'label' => BackendStrings::getTemplateStrings()['jewelry'],
139 'value' => 'jewelry',
140 'isDefault' => false,
141 'position' => 1
142 ],
143 [
144 'id' => 0,
145 'label' => BackendStrings::getTemplateStrings()['pottery'],
146 'value' => 'pottery',
147 'isDefault' => false,
148 'position' => 2
149 ],
150 [
151 'id' => 0,
152 'label' => BackendStrings::getTemplateStrings()['textiles'],
153 'value' => 'textiles',
154 'isDefault' => false,
155 'position' => 3
156 ],
157 [
158 'id' => 0,
159 'label' => BackendStrings::getTemplateStrings()['woodwork'],
160 'value' => 'woodwork',
161 'isDefault' => false,
162 'position' => 4
163 ],
164 [
165 'id' => 0,
166 'label' => BackendStrings::getTemplateStrings()['other'],
167 'value' => 'other',
168 'isDefault' => false,
169 'position' => 5
170 ],
171 ]
172 ],
173 // Products / Description
174 [
175 'id' => 0,
176 'fieldIndex' => 6,
177 'type' => 'textarea',
178 'label' => BackendStrings::getTemplateStrings()['products_description'],
179 'placeholder' => BackendStrings::getTemplateStrings()[
180 'describe_your_items'
181 ],
182 'parentId' => null,
183 'defaultValue' => '',
184 'position' => 6,
185 'required' => true,
186 'rows' => 4,
187 ],
188 ];
189 }
190
191 /**
192 * Booth details fields (space size, electricity needed)
193 *
194 * @return array<int, array<string, mixed>>
195 */
196 private static function getBoothDetailsFields(): array
197 {
198 return [
199 // Booth / Space Size Required
200 [
201 'id' => 0,
202 'fieldIndex' => 7,
203 'type' => 'number',
204 'label' => BackendStrings::getTemplateStrings()[
205 'booth_space_size_required'
206 ],
207 'placeholder' => BackendStrings::getTemplateStrings()[
208 'enter_space_size'
209 ],
210 'required' => false,
211 'parentId' => null,
212 'defaultValue' => '',
213 'position' => 7,
214 ],
215 // Need Electricity
216 [
217 'id' => 0,
218 'fieldIndex' => 8,
219 'type' => 'radio',
220 'label' => BackendStrings::getTemplateStrings()['need_electricity'],
221 'parentId' => null,
222 'position' => 8,
223 'required' => false,
224 'defaultValue' => '',
225 'placeholder' => '',
226 'fieldOptions' => [
227 [
228 'id' => 0,
229 'label' => BackendStrings::getTemplateStrings()['yes'],
230 'value' => 'yes',
231 'isDefault' => false,
232 'position' => 1
233 ],
234 [
235 'id' => 0,
236 'label' => BackendStrings::getTemplateStrings()['no'],
237 'value' => 'no',
238 'isDefault' => false,
239 'position' => 2
240 ],
241 ],
242 ],
243 ];
244 }
245
246 /**
247 * Additional fields (notes, available dates, vendor rules agreement)
248 *
249 * @return array<int, array<string, mixed>>
250 */
251 private static function getAdditionalFields(): array
252 {
253 return [
254 // Additional Notes / Requests
255 [
256 'id' => 0,
257 'fieldIndex' => 9,
258 'type' => 'textarea',
259 'label' => BackendStrings::getTemplateStrings()[
260 'additional_notes_requests'
261 ],
262 'placeholder' => BackendStrings::getTemplateStrings()[
263 'vendor_additional_notes_placeholder'
264 ],
265 'parentId' => null,
266 'defaultValue' => '',
267 'position' => 9,
268 'required' => false,
269 'rows' => 3,
270 ],
271 // Available Dates
272 [
273 'id' => 0,
274 'fieldIndex' => 10,
275 'type' => 'date',
276 'label' => BackendStrings::getTemplateStrings()['available_date'],
277 'placeholder' => BackendStrings::getTemplateStrings()[
278 'select_available_date'
279 ],
280 'required' => true,
281 'parentId' => null,
282 'defaultValue' => '',
283 'position' => 10,
284 'dateFieldType' => 'picker',
285 'dateFormat' => 'MM/DD/YYYY',
286 ],
287 // Agree to Vendor Rules & Policies
288 [
289 'id' => 0,
290 'fieldIndex' => 11,
291 'type' => 'radio',
292 'label' => BackendStrings::getTemplateStrings()[
293 'agree_vendor_rules_policies'
294 ],
295 'parentId' => null,
296 'position' => 11,
297 'required' => true,
298 'defaultValue' => '',
299 'placeholder' => '',
300 'fieldOptions' => [
301 [
302 'id' => 0,
303 'label' => BackendStrings::getTemplateStrings()['yes'],
304 'value' => 'yes',
305 'isDefault' => false,
306 'position' => 1
307 ],
308 [
309 'id' => 0,
310 'label' => BackendStrings::getTemplateStrings()['no'],
311 'value' => 'no',
312 'isDefault' => false,
313 'position' => 2
314 ],
315 ],
316 ],
317 ];
318 }
319 }
320