PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.7
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.7
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
fluentform / app / Services / Blocks / BlockAttributes.php

BlockAttributes.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.7, at app/Services/Blocks/BlockAttributes.php

357 lines 10.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Services\Blocks;
4
5 /**
6 * BlockAttributes class for defining Gutenberg block attributes
7 * @since 1.0.0
8 */
9 class BlockAttributes
10 {
11 /**
12 * Get all attributes for the Fluent Forms Gutenberg block
13 *
14 * @return array Block attributes configuration
15 */
16 public static function getAttributes()
17 {
18 return array_merge(
19 self::getFormAttributes(),
20 self::getStylesAttribute()
21 );
22 }
23
24 /**
25 * Get form specific attributes
26 *
27 * @return array Form specific attributes
28 */
29 public static function getFormAttributes()
30 {
31 return [
32 'formId' => [
33 'type' => 'string',
34 'default' => '',
35 ],
36 'className' => [
37 'type' => 'string',
38 'default' => '',
39 ],
40 'themeStyle' => [
41 'type' => 'string',
42 'default' => '',
43 ],
44 'isConversationalForm' => [
45 'type' => 'boolean',
46 'default' => false,
47 ],
48 'customCssClass' => [
49 'type' => 'string',
50 'default' => '',
51 ],
52 // Generated block custom styles
53 'customCss' => [
54 'type' => 'string',
55 'default' => '',
56 ]
57 ];
58 }
59
60 /**
61 * Get the consolidated styles attribute
62 *
63 * @return array Styles attribute configuration
64 */
65 public static function getStylesAttribute()
66 {
67 return [
68 'styles' => [
69 'type' => 'object',
70 'default' => array_merge(
71 self::getTypographyAttributes(),
72 self::getColorAttributes(),
73 self::getBorderAttributes(),
74 self::getBoxShadowAttributes(),
75 self::getBackgroundAttributes(),
76 self::getSpacingAttributes(),
77 self::getButtonAttributes(),
78 self::getMessageAttributes(),
79 self::getAdvancedAttributes()
80 ),
81 ],
82 ];
83 }
84
85 public static function getBoxShadowAttributes() {
86 return [
87 // Input box shadow
88 'inputBoxShadow' => [
89 'enable' => false,
90 'color' => '',
91 'position' => 'outline',
92 'horizontal' => ['value' => '0', 'unit' => 'px'],
93 'vertical' => ['value' => '0', 'unit' => 'px'],
94 'blur' => ['value' => '5', 'unit' => 'px'],
95 'spread' => ['value' => '0', 'unit' => 'px'],
96 ],
97 // Input box shadow focus
98 'inputBoxShadowFocus' => [
99 'enable' => false,
100 'color' => '',
101 'position' => 'outline',
102 'horizontal' => ['value' => '0', 'unit' => 'px'],
103 'vertical' => ['value' => '0', 'unit' => 'px'],
104 'blur' => ['value' => '5', 'unit' => 'px'],
105 'spread' => ['value' => '0', 'unit' => 'px'],
106 ],
107 // Container box shadow
108 'containerBoxShadow' => [
109 'enable' => false,
110 'color' => '',
111 'position' => 'outline',
112 'horizontal' => ['value' => '0', 'unit' => 'px'],
113 'vertical' => ['value' => '0', 'unit' => 'px'],
114 'blur' => ['value' => '5', 'unit' => 'px'],
115 'spread' => ['value' => '0', 'unit' => 'px'],
116 ],
117 // Button box shadow
118 'buttonBoxShadow' => [
119 'enable' => false,
120 'color' => '',
121 'position' => 'outline',
122 'horizontal' => ['value' => '0', 'unit' => 'px'],
123 'vertical' => ['value' => '0', 'unit' => 'px'],
124 'blur' => ['value' => '5', 'unit' => 'px'],
125 'spread' => ['value' => '0', 'unit' => 'px'],
126 ],
127 // Button hover box shadow
128 'buttonHoverBoxShadow' => [
129 'enable' => false,
130 'color' => '',
131 'position' => 'outline',
132 'horizontal' => ['value' => '0', 'unit' => 'px'],
133 'vertical' => ['value' => '0', 'unit' => 'px'],
134 'blur' => ['value' => '5', 'unit' => 'px'],
135 'spread' => ['value' => '0', 'unit' => 'px'],
136 ],
137 ];
138 }
139
140 /**
141 * Get typography related attributes
142 *
143 * @return array Typography related attributes
144 */
145 public static function getTypographyAttributes()
146 {
147 return [
148 'labelTypography' => [],
149 'inputTypography' => [],
150 'buttonTypography' => [],
151 'placeholderTypography' => [],
152 'radioCheckboxTypography' => [],
153 ];
154 }
155
156 /**
157 * Get color related attributes
158 *
159 * @return array Color related attributes
160 */
161 public static function getColorAttributes()
162 {
163 return [
164 'backgroundColor' => '',
165 'labelColor' => '',
166 'inputTextColor' => '',
167 'inputBackgroundColor' => '',
168 'placeholderColor' => '',
169 'placeholderFocusColor' => '',
170 'buttonColor' => '',
171 'buttonBGColor' => '',
172 'buttonHoverColor' => '',
173 'buttonHoverBGColor' => '',
174 'radioCheckboxItemsColor' => '',
175 'radioCheckboxLabelColor' => '',
176 'checkboxSize' => '',
177 'checkboxBorderColor' => '',
178 'checkboxBgColor' => '',
179 'checkboxCheckedColor' => '',
180 'radioSize' => '',
181 'radioBorderColor' => '',
182 'radioBgColor' => '',
183 'radioCheckedColor' => '',
184 'errorMessageColor' => '',
185 'errorMessageBgColor' => '',
186 'successMessageColor' => '',
187 'successMessageBgColor' => '',
188 'submitErrorMessageColor' => '',
189 'submitErrorMessageBgColor' => '',
190 'gradientColor1' => '',
191 'gradientColor2' => '',
192 'backgroundOverlayColor' => '',
193 'boxShadowColor' => '',
194 'asteriskColor' => '',
195 // Focus state colors
196 'inputTextFocusColor' => '',
197 'inputBackgroundFocusColor' => '',
198 'inputFocusSpacing' => [],
199 ];
200 }
201
202 /**
203 * Get border related attributes
204 *
205 * @return array Border related attributes
206 */
207 public static function getBorderAttributes()
208 {
209 return [
210 // Input border
211 'inputBorder' => [
212 'enable' => false,
213 'type' => 'solid',
214 'color' => '',
215 'width' => [],
216 'radius' => [],
217 ],
218 // Input focus border
219 'inputBorderFocus' => [
220 'enable' => false,
221 'type' => 'solid',
222 'color' => '',
223 'width' => [],
224 'radius' => [],
225 ],
226 // Form container border
227 'formBorder' => [
228 'enable' => false,
229 'type' => 'solid',
230 'color' => '',
231 'width' => [],
232 'radius' => [],
233 ],
234 // Button border
235 'buttonBorder' => [
236 'enable' => false,
237 'type' => 'solid',
238 'color' => '',
239 'width' => [],
240 'radius' => [],
241 ],
242 // Button hover border
243 'buttonHoverBorder' => [
244 'enable' => false,
245 'type' => 'solid',
246 'color' => '',
247 'width' => [],
248 'radius' => [],
249 ],
250 ];
251 }
252
253 /**
254 * Get background related attributes
255 *
256 * @return array Background related attributes
257 */
258 public static function getBackgroundAttributes()
259 {
260 return [
261 'backgroundType' => 'classic',
262 'backgroundImage' => '',
263 'backgroundImageId' => 0,
264 'backgroundSize' => 'cover',
265 'backgroundPosition' => 'center center',
266 'backgroundRepeat' => 'no-repeat',
267 'backgroundAttachment' => 'scroll',
268 'gradientType' => 'linear',
269 'gradientAngle' => 90,
270 'backgroundOverlayOpacity' => 0.5,
271 ];
272 }
273
274 /**
275 * Get spacing related attributes
276 *
277 * @return array Spacing related attributes
278 */
279 public static function getSpacingAttributes()
280 {
281 return [
282 'containerPadding' => [],
283 'containerMargin' => [],
284 'inputSpacing' => [],
285 'inputSpacingHover' => [],
286 'buttonPadding' => [],
287 'buttonMargin' => [],
288 'formWidth' => '',
289 'formAlignment' => '',
290 ];
291 }
292
293 /**
294 * Get button related attributes
295 *
296 * @return array Button related attributes
297 */
298 public static function getButtonAttributes()
299 {
300 return [
301 // Common button attributes
302 'buttonWidth' => '',
303 'buttonAlignment' => 'left',
304
305 // Normal state button attributes
306 'buttonTypography' => [],
307 'buttonPadding' => [],
308 'buttonMargin' => [],
309 'buttonBorderType' => 'solid',
310 'buttonBorderColor' => '',
311 'buttonBorderWidth' => [],
312 'buttonBorderRadius' => [],
313
314 // Hover state button attributes
315 'buttonHoverTypography' => [],
316 'buttonHoverPadding' => [],
317 'buttonHoverMargin' => [],
318 'enableButtonHoverBorder' => false,
319 'buttonHoverBorderType' => 'solid',
320 'buttonHoverBorderColor' => '',
321 'buttonHoverBorderWidth' => [],
322 'buttonHoverBorderRadius' => [],
323 ];
324 }
325
326 /**
327 * Get message related attributes
328 *
329 * @return array Message related attributes
330 */
331 public static function getMessageAttributes()
332 {
333 return [
334 'errorMessageAlignment' => '',
335 'successMessageAlignment' => '',
336 'submitErrorMessageAlignment' => '',
337 ];
338 }
339
340 /**
341 * Get advanced attributes
342 *
343 * @return array Advanced attributes
344 */
345 public static function getAdvancedAttributes()
346 {
347 return [
348 'radioCheckboxItemsSize' => '',
349 'customCss' => '',
350 'hideOnDesktop' => false,
351 'hideOnTablet' => false,
352 'hideOnMobile' => false,
353 'zIndex' => '',
354 ];
355 }
356 }
357