PluginProbe
The Innovative Form Builder – IvyForms / 0.6
The Innovative Form Builder – IvyForms v0.6
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.6, at backend/src/Services/Template/CharityEventRegistrationFormTemplate.php

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