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

236 lines 8.2 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 WebinarRegistrationFormTemplate
13 {
14 /**
15 * Get the webinar registration form template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'webinar_registration_form',
23 'name' => BackendStrings::getTemplateStrings()['webinar_registration_form'],
24 'description' => BackendStrings::getTemplateStrings()['webinar_registration_form_desc'],
25 'category' => 'event-registration',
26 'is_pro' => false,
27 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'webinar-registration-form.svg',
28 'form_data' => [
29 'name' => BackendStrings::getTemplateStrings()['webinar_registration_form'],
30 'published' => 1,
31 'showTitle' => 1,
32 'storeEntries' => 1,
33 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
34 'fields' => array_merge(
35 self::getParticipantInformationFields(),
36 self::getWebinarPreferencesFields(),
37 self::getAdditionalInformationFields()
38 ),
39 'settings' => []
40 ]
41 ];
42 }
43
44 /**
45 * Get participant information fields
46 *
47 * @return array<int, array<string, mixed>>
48 */
49 private static function getParticipantInformationFields(): 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' => '[email protected]',
102 'required' => true,
103 'parentId' => null,
104 'defaultValue' => '',
105 'position' => 2,
106 ],
107 ];
108 }
109
110 /**
111 * Get webinar preferences fields
112 *
113 * @return array<int, array<string, mixed>>
114 */
115 private static function getWebinarPreferencesFields(): array
116 {
117 return [
118 // Session Time
119 [
120 'id' => 0,
121 'fieldIndex' => 3,
122 'type' => 'select',
123 'label' => BackendStrings::getTemplateStrings()['session_time'],
124 'placeholder' => BackendStrings::getTemplateStrings()['select_session_time'],
125 'required' => false,
126 'parentId' => null,
127 'defaultValue' => '',
128 'position' => 3,
129 'fieldOptions' => [
130 [
131 'id' => 0,
132 'label' => BackendStrings::getTemplateStrings()['morning'],
133 'value' => 'morning',
134 'isDefault' => false,
135 'position' => 1
136 ],
137 [
138 'id' => 0,
139 'label' => BackendStrings::getTemplateStrings()['afternoon'],
140 'value' => 'afternoon',
141 'isDefault' => false,
142 'position' => 2
143 ],
144 [
145 'id' => 0,
146 'label' => BackendStrings::getTemplateStrings()['evening'],
147 'value' => 'evening',
148 'isDefault' => false,
149 'position' => 3
150 ],
151 ]
152 ],
153 // Participation Type
154 [
155 'id' => 0,
156 'fieldIndex' => 4,
157 'type' => 'radio',
158 'label' => BackendStrings::getTemplateStrings()['participation_type'],
159 'required' => true,
160 'parentId' => null,
161 'defaultValue' => '',
162 'placeholder' => '',
163 'position' => 4,
164 'fieldOptions' => [
165 [
166 'id' => 0,
167 'label' => BackendStrings::getTemplateStrings()['live'],
168 'value' => 'live',
169 'isDefault' => false,
170 'position' => 1
171 ],
172 [
173 'id' => 0,
174 'label' => BackendStrings::getTemplateStrings()['recorded'],
175 'value' => 'recorded',
176 'isDefault' => false,
177 'position' => 2
178 ],
179 ]
180 ],
181 ];
182 }
183
184 /**
185 * Get additional information fields
186 *
187 * @return array<int, array<string, mixed>>
188 */
189 private static function getAdditionalInformationFields(): array
190 {
191 return [
192 // Subscribe to Newsletter
193 [
194 'id' => 0,
195 'fieldIndex' => 5,
196 'type' => 'radio',
197 'label' => BackendStrings::getTemplateStrings()['subscribe_to_newsletter'],
198 'required' => false,
199 'parentId' => null,
200 'defaultValue' => '',
201 'placeholder' => '',
202 'position' => 5,
203 'fieldOptions' => [
204 [
205 'id' => 0,
206 'label' => BackendStrings::getTemplateStrings()['yes'],
207 'value' => 'yes',
208 'isDefault' => false,
209 'position' => 1
210 ],
211 [
212 'id' => 0,
213 'label' => BackendStrings::getTemplateStrings()['no'],
214 'value' => 'no',
215 'isDefault' => false,
216 'position' => 2
217 ],
218 ]
219 ],
220 // Questions for Speaker
221 [
222 'id' => 0,
223 'fieldIndex' => 6,
224 'type' => 'textarea',
225 'label' => BackendStrings::getTemplateStrings()['questions_for_speaker'],
226 'placeholder' => BackendStrings::getTemplateStrings()['write_your_question_here'],
227 'required' => false,
228 'parentId' => null,
229 'defaultValue' => '',
230 'position' => 6,
231 'rows' => 4,
232 ],
233 ];
234 }
235 }
236