PluginProbe
The Innovative Form Builder – IvyForms / 1.4
The Innovative Form Builder – IvyForms v1.4
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 / WebinarRegistrationFormTemplate.php

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

246 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 use IvyForms\Services\Translations\BackendStrings;
6
7 class WebinarRegistrationFormTemplate
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' => 'webinar_registration_form',
18 'name' => BackendStrings::getTemplateStrings()['webinar_registration_form'],
19 'description' => BackendStrings::getTemplateStrings()['webinar_registration_form_desc'],
20 'category' => 'event-registration-forms',
21 'subcategory' => 'webinar-registration-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'webinar-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()['webinar_registration_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getParticipantInformationFields(),
45 self::getWebinarPreferencesFields(),
46 self::getAdditionalInformationFields()
47 ),
48 'settings' => []
49 ]
50 ]
51 );
52 }
53
54 /**
55 * Get participant information fields
56 *
57 * @return array<int, array<string, mixed>>
58 */
59 private static function getParticipantInformationFields(): 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' => '[email protected]',
112 'required' => true,
113 'parentId' => null,
114 'defaultValue' => '',
115 'position' => 2,
116 ],
117 ];
118 }
119
120 /**
121 * Get webinar preferences fields
122 *
123 * @return array<int, array<string, mixed>>
124 */
125 private static function getWebinarPreferencesFields(): array
126 {
127 return [
128 // Session Time
129 [
130 'id' => 8,
131 'fieldIndex' => 3,
132 'type' => 'select',
133 'label' => BackendStrings::getTemplateStrings()['session_time'],
134 'placeholder' => BackendStrings::getTemplateStrings()['select_session_time'],
135 'required' => false,
136 'parentId' => null,
137 'defaultValue' => '',
138 'position' => 3,
139 'fieldOptions' => [
140 [
141 'id' => 5,
142 'label' => BackendStrings::getTemplateStrings()['morning'],
143 'value' => 'morning',
144 'isDefault' => false,
145 'position' => 1
146 ],
147 [
148 'id' => 6,
149 'label' => BackendStrings::getTemplateStrings()['afternoon'],
150 'value' => 'afternoon',
151 'isDefault' => false,
152 'position' => 2
153 ],
154 [
155 'id' => 7,
156 'label' => BackendStrings::getTemplateStrings()['evening'],
157 'value' => 'evening',
158 'isDefault' => false,
159 'position' => 3
160 ],
161 ]
162 ],
163 // Participation Type
164 [
165 'id' => 11,
166 'fieldIndex' => 4,
167 'type' => 'radio',
168 'label' => BackendStrings::getTemplateStrings()['participation_type'],
169 'required' => true,
170 'parentId' => null,
171 'defaultValue' => '',
172 'placeholder' => '',
173 'position' => 4,
174 'fieldOptions' => [
175 [
176 'id' => 9,
177 'label' => BackendStrings::getTemplateStrings()['live'],
178 'value' => 'live',
179 'isDefault' => false,
180 'position' => 1
181 ],
182 [
183 'id' => 10,
184 'label' => BackendStrings::getTemplateStrings()['recorded'],
185 'value' => 'recorded',
186 'isDefault' => false,
187 'position' => 2
188 ],
189 ]
190 ],
191 ];
192 }
193
194 /**
195 * Get additional information fields
196 *
197 * @return array<int, array<string, mixed>>
198 */
199 private static function getAdditionalInformationFields(): array
200 {
201 return [
202 // Subscribe to Newsletter
203 [
204 'id' => 14,
205 'fieldIndex' => 5,
206 'type' => 'radio',
207 'label' => BackendStrings::getTemplateStrings()['subscribe_to_newsletter'],
208 'required' => false,
209 'parentId' => null,
210 'defaultValue' => '',
211 'placeholder' => '',
212 'position' => 5,
213 'fieldOptions' => [
214 [
215 'id' => 12,
216 'label' => BackendStrings::getTemplateStrings()['yes'],
217 'value' => 'yes',
218 'isDefault' => false,
219 'position' => 1
220 ],
221 [
222 'id' => 13,
223 'label' => BackendStrings::getTemplateStrings()['no'],
224 'value' => 'no',
225 'isDefault' => false,
226 'position' => 2
227 ],
228 ]
229 ],
230 // Questions for Speaker
231 [
232 'id' => 15,
233 'fieldIndex' => 6,
234 'type' => 'textarea',
235 'label' => BackendStrings::getTemplateStrings()['questions_for_speaker'],
236 'placeholder' => BackendStrings::getTemplateStrings()['write_your_question_here'],
237 'required' => false,
238 'parentId' => null,
239 'defaultValue' => '',
240 'position' => 6,
241 'rows' => 4,
242 ],
243 ];
244 }
245 }
246