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 / CharityEventRegistrationFormTemplate.php

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

240 lines 8.4 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 CharityEventRegistrationFormTemplate
13 {
14 /**
15 * Get the charity event registration form template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'charity_event_registration_form',
23 'name' => BackendStrings::getTemplateStrings()['charity_event_registration_form'],
24 'description' => BackendStrings::getTemplateStrings()['charity_event_registration_form_desc'],
25 'category' => 'event-registration-forms',
26 'subcategory' => 'charity-event-forms',
27 'is_pro' => false,
28 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'charity-event-registration-form.svg',
29 'form_data' => [
30 'name' => BackendStrings::getTemplateStrings()['charity_event_registration_form'],
31 'published' => 1,
32 'showTitle' => 1,
33 'storeEntries' => 1,
34 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
35 'fields' => array_merge(
36 self::getPersonalInformationFields(),
37 self::getCharityEventFields(),
38 self::getAdditionalInformationFields()
39 ),
40 'settings' => []
41 ]
42 ];
43 }
44
45 /**
46 * Get personal information fields
47 *
48 * @return array<int, array<string, mixed>>
49 */
50 private static function getPersonalInformationFields(): array
51 {
52 return [
53 // Name Field - Parent
54 [
55 'id' => 0,
56 'fieldIndex' => 1,
57 'type' => 'name',
58 'label' => BackendStrings::getTemplateStrings()['full_name'],
59 'parentId' => null,
60 'defaultValue' => '',
61 'placeholder' => '',
62 'required' => true,
63 'readonly' => false,
64 'position' => 1,
65 ],
66 // First Name - Child of Name Field
67 [
68 'id' => 0,
69 'type' => 'text',
70 'label' => BackendStrings::getNewFormStrings()['first_name'],
71 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
72 'required' => true,
73 'parentId' => 0,
74 'fieldIndex' => 1,
75 'defaultValue' => '',
76 'position' => 1,
77 'optionHide' => false,
78 'description' => '',
79 'settings' => json_encode(['nameFieldType' => 'nameField1']),
80 ],
81 // Last Name - Child of Name Field
82 [
83 'id' => 0,
84 'type' => 'text',
85 'label' => BackendStrings::getNewFormStrings()['last_name'],
86 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
87 'required' => true,
88 'parentId' => 0,
89 'fieldIndex' => 1,
90 'defaultValue' => '',
91 'position' => 2,
92 'optionHide' => false,
93 'description' => '',
94 'settings' => json_encode(['nameFieldType' => 'nameField2']),
95 ],
96 // Email Address
97 [
98 'id' => 0,
99 'fieldIndex' => 2,
100 'type' => 'email',
101 'label' => BackendStrings::getTemplateStrings()['email_address'],
102 'placeholder' => BackendStrings::getTemplateStrings()['email_address'],
103 'required' => true,
104 'parentId' => null,
105 'defaultValue' => '',
106 'position' => 2,
107 ],
108 // Phone Number
109 [
110 'id' => 0,
111 'fieldIndex' => 3,
112 'type' => 'phone',
113 'label' => BackendStrings::getTemplateStrings()['phone_number'],
114 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_phone_number'],
115 'required' => false,
116 'parentId' => null,
117 'defaultValue' => '',
118 'position' => 3,
119 ],
120 ];
121 }
122
123 /**
124 * Get charity event details fields
125 *
126 * @return array<int, array<string, mixed>>
127 */
128 private static function getCharityEventFields(): array
129 {
130 return [
131 // Volunteer Role
132 [
133 'id' => 0,
134 'fieldIndex' => 4,
135 'type' => 'select',
136 'label' => BackendStrings::getTemplateStrings()['volunteer_role'],
137 'placeholder' => BackendStrings::getTemplateStrings()['select_role'],
138 'required' => true,
139 'parentId' => null,
140 'defaultValue' => '',
141 'position' => 4,
142 'fieldOptions' => [
143 [
144 'id' => 0,
145 'label' => BackendStrings::getTemplateStrings()['setup'],
146 'value' => 'setup',
147 'isDefault' => false,
148 'position' => 1
149 ],
150 [
151 'id' => 0,
152 'label' => BackendStrings::getTemplateStrings()['registration'],
153 'value' => 'registration',
154 'isDefault' => false,
155 'position' => 2
156 ],
157 [
158 'id' => 0,
159 'label' => BackendStrings::getTemplateStrings()['fundraising'],
160 'value' => 'fundraising',
161 'isDefault' => false,
162 'position' => 3
163 ],
164 [
165 'id' => 0,
166 'label' => BackendStrings::getTemplateStrings()['cleanup'],
167 'value' => 'cleanup',
168 'isDefault' => false,
169 'position' => 4
170 ],
171 ]
172 ],
173 // Donation Amount
174 [
175 'id' => 0,
176 'fieldIndex' => 5,
177 'type' => 'number',
178 'label' => BackendStrings::getTemplateStrings()['donation_amount'],
179 'placeholder' => BackendStrings::getTemplateStrings()['enter_donation_amount'],
180 'required' => false,
181 'parentId' => null,
182 'defaultValue' => '',
183 'position' => 5,
184 ],
185 ];
186 }
187
188 /**
189 * Get additional information fields
190 *
191 * @return array<int, array<string, mixed>>
192 */
193 private static function getAdditionalInformationFields(): array
194 {
195 return [
196 // Subscribe to Newsletter
197 [
198 'id' => 0,
199 'fieldIndex' => 6,
200 'type' => 'radio',
201 'label' => BackendStrings::getTemplateStrings()['subscribe_to_newsletter'],
202 'required' => false,
203 'parentId' => null,
204 'defaultValue' => '',
205 'placeholder' => '',
206 'position' => 6,
207 'fieldOptions' => [
208 [
209 'id' => 0,
210 'label' => BackendStrings::getTemplateStrings()['yes'],
211 'value' => 'yes',
212 'isDefault' => false,
213 'position' => 1
214 ],
215 [
216 'id' => 0,
217 'label' => BackendStrings::getTemplateStrings()['no'],
218 'value' => 'no',
219 'isDefault' => false,
220 'position' => 2
221 ],
222 ]
223 ],
224 // Special Notes
225 [
226 'id' => 0,
227 'fieldIndex' => 7,
228 'type' => 'textarea',
229 'label' => BackendStrings::getTemplateStrings()['special_notes'],
230 'placeholder' => BackendStrings::getTemplateStrings()['any_special_notes'],
231 'required' => false,
232 'parentId' => null,
233 'defaultValue' => '',
234 'position' => 7,
235 'rows' => 4,
236 ],
237 ];
238 }
239 }
240