PluginProbe
The Innovative Form Builder – IvyForms / 1.1.1
The Innovative Form Builder – IvyForms v1.1.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 / CharityEventRegistrationFormTemplate.php

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

250 lines 8.7 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 CharityEventRegistrationFormTemplate
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' => 'charity_event_registration_form',
18 'name' => BackendStrings::getTemplateStrings()['charity_event_registration_form'],
19 'description' => BackendStrings::getTemplateStrings()['charity_event_registration_form_desc'],
20 'category' => 'event-registration-forms',
21 'subcategory' => 'charity-event-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'charity-event-registration-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()['charity_event_registration_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getPersonalInformationFields(),
45 self::getCharityEventFields(),
46 self::getAdditionalInformationFields()
47 ),
48 'settings' => []
49 ]
50 ]
51 );
52 }
53
54 /**
55 * Get personal information fields
56 *
57 * @return array<int, array<string, mixed>>
58 */
59 private static function getPersonalInformationFields(): array
60 {
61 return [
62 // Name Field - Parent
63 [
64 'id' => 1,
65 'fieldIndex' => 1,
66 'type' => 'name',
67 'label' => BackendStrings::getTemplateStrings()['full_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_first_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' => BackendStrings::getTemplateStrings()['email_address'],
112 'required' => true,
113 'parentId' => null,
114 'defaultValue' => '',
115 'position' => 2,
116 ],
117 // Phone Number
118 [
119 'id' => 5,
120 'fieldIndex' => 3,
121 'type' => 'phone',
122 'label' => BackendStrings::getTemplateStrings()['phone_number'],
123 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_phone_number'],
124 'required' => false,
125 'parentId' => null,
126 'defaultValue' => '',
127 'position' => 3,
128 'phoneAutoDetect' => true,
129 ],
130 ];
131 }
132
133 /**
134 * Get charity event details fields
135 *
136 * @return array<int, array<string, mixed>>
137 */
138 private static function getCharityEventFields(): array
139 {
140 return [
141 // Volunteer Role
142 [
143 'id' => 10,
144 'fieldIndex' => 4,
145 'type' => 'select',
146 'label' => BackendStrings::getTemplateStrings()['volunteer_role'],
147 'placeholder' => BackendStrings::getTemplateStrings()['select_role'],
148 'required' => true,
149 'parentId' => null,
150 'defaultValue' => '',
151 'position' => 4,
152 'fieldOptions' => [
153 [
154 'id' => 6,
155 'label' => BackendStrings::getTemplateStrings()['setup'],
156 'value' => 'setup',
157 'isDefault' => false,
158 'position' => 1
159 ],
160 [
161 'id' => 7,
162 'label' => BackendStrings::getTemplateStrings()['registration'],
163 'value' => 'registration',
164 'isDefault' => false,
165 'position' => 2
166 ],
167 [
168 'id' => 8,
169 'label' => BackendStrings::getTemplateStrings()['fundraising'],
170 'value' => 'fundraising',
171 'isDefault' => false,
172 'position' => 3
173 ],
174 [
175 'id' => 9,
176 'label' => BackendStrings::getTemplateStrings()['cleanup'],
177 'value' => 'cleanup',
178 'isDefault' => false,
179 'position' => 4
180 ],
181 ]
182 ],
183 // Donation Amount
184 [
185 'id' => 11,
186 'fieldIndex' => 5,
187 'type' => 'number',
188 'label' => BackendStrings::getTemplateStrings()['donation_amount'],
189 'placeholder' => BackendStrings::getTemplateStrings()['enter_donation_amount'],
190 'required' => false,
191 'parentId' => null,
192 'defaultValue' => '',
193 'position' => 5,
194 ],
195 ];
196 }
197
198 /**
199 * Get additional information fields
200 *
201 * @return array<int, array<string, mixed>>
202 */
203 private static function getAdditionalInformationFields(): array
204 {
205 return [
206 // Subscribe to Newsletter
207 [
208 'id' => 14,
209 'fieldIndex' => 6,
210 'type' => 'radio',
211 'label' => BackendStrings::getTemplateStrings()['subscribe_to_newsletter'],
212 'required' => false,
213 'parentId' => null,
214 'defaultValue' => '',
215 'placeholder' => '',
216 'position' => 6,
217 'fieldOptions' => [
218 [
219 'id' => 12,
220 'label' => BackendStrings::getTemplateStrings()['yes'],
221 'value' => 'yes',
222 'isDefault' => false,
223 'position' => 1
224 ],
225 [
226 'id' => 13,
227 'label' => BackendStrings::getTemplateStrings()['no'],
228 'value' => 'no',
229 'isDefault' => false,
230 'position' => 2
231 ],
232 ]
233 ],
234 // Special Notes
235 [
236 'id' => 15,
237 'fieldIndex' => 7,
238 'type' => 'textarea',
239 'label' => BackendStrings::getTemplateStrings()['special_notes'],
240 'placeholder' => BackendStrings::getTemplateStrings()['any_special_notes'],
241 'required' => false,
242 'parentId' => null,
243 'defaultValue' => '',
244 'position' => 7,
245 'rows' => 4,
246 ],
247 ];
248 }
249 }
250