PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.14.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.14.0
2.14.0 2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 All 81 releases
← All changes | includes/blocks/tabs/block.php +949 -0 2.7.7 → 2.14.0 View file →
@@ -1,0 +1,949 @@
1 +<?php
2 +
3 +namespace ABlocks\Blocks\Tabs;
4 +
5 +if ( ! defined( 'ABSPATH' ) ) {
6 + exit;
7 +}
8 +
9 +use ABlocks\Classes\BlockBaseAbstract;
10 +use ABlocks\Classes\CssGenerator;
11 +use ABlocks\Classes\CssGeneratorV2;
12 +use ABlocks\Controls\Typography;
13 +use ABlocks\Controls\Dimensions;
14 +use ABlocks\Controls\Border;
15 +use ABlocks\Controls\Icon;
16 +use ABlocks\Controls\BoxShadow;
17 +use ABlocks\Controls\Range;
18 +use ABlocks\Controls\Color;
19 +
20 +
21 +class Block extends BlockBaseAbstract {
22 +
23 + protected $block_name = 'tabs';
24 +
25 + public function build_css_v1( $attributes ) {
26 + $css_generator = new CssGenerator( $attributes, $this->block_name );
27 +
28 + $css_generator->add_class_styles(
29 + '{{WRAPPER}} .ablocks-block-tabs',
30 + $this->get_tabs_css( $attributes ),
31 + $this->get_tabs_css( $attributes, 'Tablet' ),
32 + $this->get_tabs_css( $attributes, 'Mobile' ),
33 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_css( $attributes, $device ); } )
34 + );
35 + $css_generator->add_class_styles(
36 + '{{WRAPPER}} .ablocks-block-tabs__tab-panel',
37 + $this->get_tabs_panel_css( $attributes ),
38 + $this->get_tabs_panel_css( $attributes, 'Tablet' ),
39 + $this->get_tabs_panel_css( $attributes, 'Mobile' ),
40 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_panel_css( $attributes, $device ); } )
41 + );
42 +
43 + $css_generator->add_class_styles(
44 + '{{WRAPPER}} .ablocks-block-tabs__tab-panel:hover',
45 + $this->get_tabs_panel_hover_css( $attributes ),
46 + $this->get_tabs_panel_hover_css( $attributes, 'Tablet' ),
47 + $this->get_tabs_panel_hover_css( $attributes, 'Mobile' ),
48 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_panel_hover_css( $attributes, $device ); } )
49 + );
50 +
51 + $css_generator->add_class_styles(
52 + '{{WRAPPER}} .ablocks-block-tabs__tab',
53 + $this->get_tabs_menu_content_css( $attributes ),
54 + $this->get_tabs_menu_content_css( $attributes, 'Tablet' ),
55 + $this->get_tabs_menu_content_css( $attributes, 'Mobile' ),
56 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_menu_content_css( $attributes, $device ); } )
57 + );
58 +
59 + $css_generator->add_class_styles(
60 + '{{WRAPPER}} .ablocks-block-tabs__tab--active',
61 + $this->get_tabs_menu_content_active_css( $attributes ),
62 + $this->get_tabs_menu_content_active_css( $attributes, 'Tablet' ),
63 + $this->get_tabs_menu_content_active_css( $attributes, 'Mobile' ),
64 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_menu_content_active_css( $attributes, $device ); } )
65 + );
66 +
67 + $css_generator->add_class_styles(
68 + '{{WRAPPER}} .ablocks-block-tabs__tab:hover',
69 + $this->get_tabs_menu_content_hover_css( $attributes ),
70 + $this->get_tabs_menu_content_hover_css( $attributes, 'Tablet' ),
71 + $this->get_tabs_menu_content_hover_css( $attributes, 'Mobile' ),
72 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_menu_content_hover_css( $attributes, $device ); } )
73 + );
74 + $css_generator->add_class_styles(
75 + '{{WRAPPER}} .ablocks-block-tabs__tab-menu-title',
76 + $this->get_tabs_title_css( $attributes ),
77 + $this->get_tabs_title_css( $attributes, 'Tablet' ),
78 + $this->get_tabs_title_css( $attributes, 'Mobile' ),
79 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_title_css( $attributes, $device ); } )
80 + );
81 +
82 + $css_generator->add_class_styles(
83 + '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__tab-menu-title',
84 + $this->get_tabs_active_title_css( $attributes ),
85 + $this->get_tabs_active_title_css( $attributes, 'Tablet' ),
86 + $this->get_tabs_active_title_css( $attributes, 'Mobile' ),
87 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_active_title_css( $attributes, $device ); } )
88 + );
89 +
90 + $css_generator->add_class_styles(
91 + '{{WRAPPER}} .ablocks-block-tabs__tab-menu-subtitle',
92 + $this->get_tabs_subtitle_css( $attributes ),
93 + $this->get_tabs_subtitle_css( $attributes, 'Tablet' ),
94 + $this->get_tabs_subtitle_css( $attributes, 'Mobile' ),
95 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_subtitle_css( $attributes, $device ); } )
96 + );
97 +
98 + $css_generator->add_class_styles(
99 + '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__tab-menu-subtitle',
100 + $this->get_tabs_active_subtitle_text_css( $attributes ),
101 + $this->get_tabs_active_subtitle_text_css( $attributes, 'Tablet' ),
102 + $this->get_tabs_active_subtitle_text_css( $attributes, 'Mobile' ),
103 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_active_subtitle_text_css( $attributes, $device ); } )
104 + );
105 + if ( isset( $attributes['showActiveSubTitle'] ) && $attributes['showActiveSubTitle'] === false ) {
106 + $css_generator->add_class_styles(
107 + '{{WRAPPER}} .ablocks-block-tabs__icon',
108 + $this->get_icon_position_css( $attributes ),
109 + $this->get_icon_position_css( $attributes, 'Tablet' ),
110 + $this->get_icon_position_css( $attributes, 'Mobile' ),
111 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_icon_position_css( $attributes, $device ); } )
112 + );
113 + } else {
114 + $css_generator->add_class_styles(
115 + '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__icon',
116 + $this->get_icon_position_css( $attributes ),
117 + $this->get_icon_position_css( $attributes, 'Tablet' ),
118 + $this->get_icon_position_css( $attributes, 'Mobile' ),
119 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_icon_position_css( $attributes, $device ); } )
120 + );
121 + }
122 + $css_generator->add_class_styles(
123 + '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__progressbar',
124 + $this->progress_bar_style_css( $attributes ),
125 + $this->progress_bar_style_css( $attributes, 'Tablet' ),
126 + $this->progress_bar_style_css( $attributes, 'Mobile' ),
127 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->progress_bar_style_css( $attributes, $device ); } )
128 + );
129 + $tabs_element_icon_wrapper_styles = Icon::get_wrapper_css( $attributes );
130 +
131 + $spacing_value = [];
132 +
133 + switch ( $attributes['iconPosition'] ) {
134 + case 'left':
135 + $spacing_value = Range::get_css([
136 + 'attributeValue' => $attributes['spacing'] ?? null,
137 + 'attributeObjectKey' => 'value',
138 + 'defaultValue' => 0,
139 + 'isResponsive' => true,
140 + 'hasUnit' => true,
141 + 'property' => 'margin-right',
142 + 'unitDefaultValue' => 'px',
143 + ]);
144 + break;
145 + case 'right':
146 + $spacing_value = Range::get_css([
147 + 'attributeValue' => $attributes['spacing'] ?? null,
148 + 'attributeObjectKey' => 'value',
149 + 'defaultValue' => 0,
150 + 'isResponsive' => true,
151 + 'hasUnit' => true,
152 + 'property' => 'margin-left',
153 + 'unitDefaultValue' => 'px',
154 + ]);
155 + break;
156 + case 'bottom':
157 + $spacing_value = Range::get_css([
158 + 'attributeValue' => $attributes['spacing'] ?? null,
159 + 'attributeObjectKey' => 'value',
160 + 'defaultValue' => 0,
161 + 'isResponsive' => true,
162 + 'hasUnit' => true,
163 + 'property' => 'margin-top',
164 + 'unitDefaultValue' => 'px',
165 + ]);
166 + break;
167 + case 'top':
168 + $spacing_value = Range::get_css([
169 + 'attributeValue' => $attributes['spacing'] ?? null,
170 + 'attributeObjectKey' => 'value',
171 + 'defaultValue' => 0,
172 + 'isResponsive' => true,
173 + 'hasUnit' => true,
174 + 'property' => 'margin-bottom',
175 + 'unitDefaultValue' => 'px',
176 + ]);
177 + break;
178 + }//end switch
179 +
180 + // Merge $spacing_value into icon wrapper styles
181 + $tabs_element_icon_wrapper_styles = array_merge(
182 + Icon::get_wrapper_css( $attributes ),
183 + $spacing_value
184 + );
185 +
186 + // Generate tablet and mobile styles for the icon wrapper
187 + $tablet_styles = array_merge(
188 + Icon::get_wrapper_css( $attributes, 'Tablet' ),
189 + $spacing_value
190 + );
191 + $mobile_styles = array_merge(
192 + Icon::get_wrapper_css( $attributes, 'Mobile' ),
193 + $spacing_value
194 + );
195 +
196 + // Add icon wrapper styles to the CSS generator
197 + if ( ! empty( $tabs_element_icon_wrapper_styles ) || ! empty( $tablet_styles ) || ! empty( $mobile_styles ) ) {
198 + $css_generator->add_class_styles(
199 + '{{WRAPPER}} .ablocks-block-tabs__icon .ablocks-icon-wrap',
200 + $tabs_element_icon_wrapper_styles,
201 + $tablet_styles,
202 + $mobile_styles
203 + );
204 + }
205 + $css_generator->add_class_styles(
206 + '{{WRAPPER}} .ablocks-block-tabs__icon .ablocks-icon-wrap:hover',
207 + Icon::get_wrapper_hover_css( $attributes ),
208 + Icon::get_wrapper_hover_css( $attributes, 'Tablet' ),
209 + Icon::get_wrapper_hover_css( $attributes, 'Mobile' ),
210 + );
211 +
212 + $css_generator->add_class_styles(
213 + '{{WRAPPER}} .ablocks-block-tabs__icon .ablocks-icon-wrap img.ablocks-image-icon',
214 + Icon::get_element_image_css( $attributes ),
215 + Icon::get_element_image_css( $attributes, 'Tablet' ),
216 + Icon::get_element_image_css( $attributes, 'Mobile' ),
217 + );
218 + $css_generator->add_class_styles(
219 + '{{WRAPPER}} .ablocks-block-tabs__icon .ablocks-icon-wrap img.ablocks-image-icon:hover',
220 + Icon::get_element_image_hover_css( $attributes ),
221 + Icon::get_element_image_hover_css( $attributes, 'Tablet' ),
222 + Icon::get_element_image_hover_css( $attributes, 'Mobile' ),
223 + );
224 + $css_generator->add_class_styles(
225 + '{{WRAPPER}} .ablocks-block-tabs__icon .ablocks-icon-wrap svg.ablocks-svg-icon',
226 + Icon::get_element_css( $attributes ),
227 + Icon::get_element_css( $attributes, 'Tablet' ),
228 + Icon::get_element_css( $attributes, 'Mobile' ),
229 + );
230 + $css_generator->add_class_styles(
231 + '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__icon .ablocks-icon-wrap svg.ablocks-svg-icon',
232 + $this->get_tabs_active_icon_css( $attributes )
233 + );
234 + $css_generator->add_class_styles(
235 + '{{WRAPPER}} .ablocks-block-tabs__icon .ablocks-icon-wrap svg.ablocks-svg-icon:hover',
236 + Icon::get_element_image_hover_css( $attributes ),
237 + Icon::get_element_image_hover_css( $attributes, 'Tablet' ),
238 + Icon::get_element_image_hover_css( $attributes, 'Mobile' ),
239 + );
240 +
241 + $css_generator->add_class_styles(
242 + '{{WRAPPER}} .ablocks-block-tabs__body',
243 + $this->get_tabs_content_css( $attributes ),
244 + $this->get_tabs_content_css( $attributes, 'Tablet' ),
245 + $this->get_tabs_content_css( $attributes, 'Mobile' ),
246 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_content_css( $attributes, $device ); } )
247 + );
248 +
249 + $css_generator->add_class_styles(
250 + '{{WRAPPER}} .ablocks-block-tabs__body:hover',
251 + $this->get_tabs_content_hover_css( $attributes ),
252 + $this->get_tabs_content_hover_css( $attributes, 'Tablet' ),
253 + $this->get_tabs_content_hover_css( $attributes, 'Mobile' ),
254 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_content_hover_css( $attributes, $device ); } )
255 + );
256 + $css_generator->add_class_styles(
257 + '{{WRAPPER}} .ablocks-block-tabs__tab-menu-content',
258 + $this->get_content_css( $attributes ),
259 + $this->get_content_css( $attributes, 'Tablet' ),
260 + $this->get_content_css( $attributes, 'Mobile' ),
261 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_css( $attributes, $device ); } )
262 + );
263 + $css_generator->add_class_styles(
264 + '{{WRAPPER}} .ablocks-block-tabs__tab-panel',
265 + $this->get_tabs_width_css( $attributes ),
266 + $this->get_tabs_width_css( $attributes, 'Tablet' ),
267 + $this->get_tabs_width_css( $attributes, 'Mobile' ),
268 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_width_css( $attributes, $device ); } )
269 + );
270 + $css_generator->add_class_styles(
271 + '{{WRAPPER}} .ablocks-block-tabs__body',
272 + $this->get_content_width_css( $attributes ),
273 + $this->get_content_width_css( $attributes, 'Tablet' ),
274 + $this->get_content_width_css( $attributes, 'Mobile' ),
275 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_width_css( $attributes, $device ); } )
276 + );
277 +
278 + return $css_generator->generate_css();
279 + }
280 + public function build_css_v2( $attributes ) {
281 + $css_generator = new CssGeneratorV2( $attributes, $this->block_name );
282 +
283 + $css_generator->add_class_styles(
284 + '{{WRAPPER}} .ablocks-block-tabs',
285 + $this->get_tabs_css( $attributes ),
286 + $this->get_tabs_css( $attributes, 'Tablet' ),
287 + $this->get_tabs_css( $attributes, 'Mobile' ),
288 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_css( $attributes, $device ); } )
289 + );
290 +
291 + $css_generator->add_class_styles(
292 + '{{WRAPPER}} .ablocks-block-tabs__tab-panel',
293 + $this->get_tabs_panel_css( $attributes ),
294 + $this->get_tabs_panel_css( $attributes, 'Tablet' ),
295 + $this->get_tabs_panel_css( $attributes, 'Mobile' ),
296 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_panel_css( $attributes, $device ); } )
297 + );
298 +
299 + $css_generator->add_class_styles(
300 + '{{WRAPPER}} .ablocks-block-tabs__tab-panel:hover',
301 + $this->get_tabs_panel_hover_css( $attributes ),
302 + $this->get_tabs_panel_hover_css( $attributes, 'Tablet' ),
303 + $this->get_tabs_panel_hover_css( $attributes, 'Mobile' ),
304 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_panel_hover_css( $attributes, $device ); } )
305 + );
306 +
307 + $css_generator->add_class_styles(
308 + '{{WRAPPER}} .ablocks-block-tabs__tab',
309 + $this->get_tabs_menu_content_css( $attributes ),
310 + $this->get_tabs_menu_content_css( $attributes, 'Tablet' ),
311 + $this->get_tabs_menu_content_css( $attributes, 'Mobile' ),
312 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_menu_content_css( $attributes, $device ); } )
313 + );
314 +
315 + $css_generator->add_class_styles(
316 + '{{WRAPPER}} .ablocks-block-tabs__tab--active',
317 + $this->get_tabs_menu_content_active_css( $attributes ),
318 + $this->get_tabs_menu_content_active_css( $attributes, 'Tablet' ),
319 + $this->get_tabs_menu_content_active_css( $attributes, 'Mobile' ),
320 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_menu_content_active_css( $attributes, $device ); } )
321 + );
322 +
323 + $css_generator->add_class_styles(
324 + '{{WRAPPER}} .ablocks-block-tabs__tab:hover',
325 + $this->get_tabs_menu_content_hover_css( $attributes ),
326 + $this->get_tabs_menu_content_hover_css( $attributes, 'Tablet' ),
327 + $this->get_tabs_menu_content_hover_css( $attributes, 'Mobile' ),
328 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_menu_content_hover_css( $attributes, $device ); } )
329 + );
330 + $css_generator->add_class_styles(
331 + '{{WRAPPER}} .ablocks-block-tabs__tab-menu-title',
332 + $this->get_tabs_title_css( $attributes ),
333 + $this->get_tabs_title_css( $attributes, 'Tablet' ),
334 + $this->get_tabs_title_css( $attributes, 'Mobile' ),
335 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_title_css( $attributes, $device ); } )
336 + );
337 +
338 + $css_generator->add_class_styles(
339 + '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__tab-menu-title',
340 + $this->get_tabs_active_title_css( $attributes ),
341 + $this->get_tabs_active_title_css( $attributes, 'Tablet' ),
342 + $this->get_tabs_active_title_css( $attributes, 'Mobile' ),
343 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_active_title_css( $attributes, $device ); } )
344 + );
345 +
346 + $css_generator->add_class_styles(
347 + '{{WRAPPER}} .ablocks-block-tabs__tab-menu-subtitle',
348 + $this->get_tabs_subtitle_css( $attributes ),
349 + $this->get_tabs_subtitle_css( $attributes, 'Tablet' ),
350 + $this->get_tabs_subtitle_css( $attributes, 'Mobile' ),
351 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_subtitle_css( $attributes, $device ); } )
352 + );
353 +
354 + $css_generator->add_class_styles(
355 + '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__tab-menu-subtitle',
356 + $this->get_tabs_active_subtitle_text_css( $attributes ),
357 + $this->get_tabs_active_subtitle_text_css( $attributes, 'Tablet' ),
358 + $this->get_tabs_active_subtitle_text_css( $attributes, 'Mobile' ),
359 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_active_subtitle_text_css( $attributes, $device ); } )
360 + );
361 + if ( isset( $attributes['showActiveSubTitle'] ) && $attributes['showActiveSubTitle'] === false ) {
362 + $css_generator->add_class_styles(
363 + '{{WRAPPER}} .ablocks-block-tabs__icon',
364 + $this->get_icon_position_css( $attributes ),
365 + $this->get_icon_position_css( $attributes, 'Tablet' ),
366 + $this->get_icon_position_css( $attributes, 'Mobile' ),
367 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_icon_position_css( $attributes, $device ); } )
368 + );
369 + } else {
370 + $css_generator->add_class_styles(
371 + '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__icon',
372 + $this->get_icon_position_css( $attributes ),
373 + $this->get_icon_position_css( $attributes, 'Tablet' ),
374 + $this->get_icon_position_css( $attributes, 'Mobile' ),
375 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_icon_position_css( $attributes, $device ); } )
376 + );
377 + }
378 + $css_generator->add_class_styles(
379 + '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__progressbar',
380 + $this->progress_bar_style_css( $attributes ),
381 + $this->progress_bar_style_css( $attributes, 'Tablet' ),
382 + $this->progress_bar_style_css( $attributes, 'Mobile' ),
383 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->progress_bar_style_css( $attributes, $device ); } )
384 + );
385 + $css_generator->add_class_styles(
386 + '{{WRAPPER}} .ablocks-block-tabs__icon .ablocks-icon-wrap',
387 + Icon::get_wrapper_css( $attributes ),
388 + Icon::get_wrapper_css( $attributes, 'Tablet' ),
389 + Icon::get_wrapper_css( $attributes, 'Mobile' ),
390 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_wrapper_css( $attributes, $device ); } )
391 + );
392 + $css_generator->add_class_styles(
393 + '{{WRAPPER}} .ablocks-block-tabs__icon .ablocks-icon-wrap:hover',
394 + Icon::get_wrapper_hover_css( $attributes ),
395 + Icon::get_wrapper_hover_css( $attributes, 'Tablet' ),
396 + Icon::get_wrapper_hover_css( $attributes, 'Mobile' ),
397 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_wrapper_hover_css( $attributes, $device ); } )
398 + );
399 + $css_generator->add_class_styles(
400 + '{{WRAPPER}} .ablocks-block-tabs__icon .ablocks-icon-wrap',
401 + $this->get_icon_spacing_css( $attributes ),
402 + $this->get_icon_spacing_css( $attributes, 'Tablet' ),
403 + $this->get_icon_spacing_css( $attributes, 'Mobile' ),
404 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_icon_spacing_css( $attributes, $device ); } )
405 + );
406 +
407 + $css_generator->add_class_styles(
408 + '{{WRAPPER}} .ablocks-block-tabs__icon .ablocks-icon-wrap img.ablocks-image-icon',
409 + Icon::get_element_image_css( $attributes ),
410 + Icon::get_element_image_css( $attributes, 'Tablet' ),
411 + Icon::get_element_image_css( $attributes, 'Mobile' ),
412 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_element_image_css( $attributes, $device ); } )
413 + );
414 + $css_generator->add_class_styles(
415 + '{{WRAPPER}} .ablocks-block-tabs__icon .ablocks-icon-wrap img.ablocks-image-icon:hover',
416 + Icon::get_element_image_hover_css( $attributes ),
417 + Icon::get_element_image_hover_css( $attributes, 'Tablet' ),
418 + Icon::get_element_image_hover_css( $attributes, 'Mobile' ),
419 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_element_image_hover_css( $attributes, $device ); } )
420 + );
421 + $css_generator->add_class_styles(
422 + '{{WRAPPER}} .ablocks-block-tabs__icon .ablocks-icon-wrap svg.ablocks-svg-icon',
423 + Icon::get_element_css( $attributes ),
424 + Icon::get_element_css( $attributes, 'Tablet' ),
425 + Icon::get_element_css( $attributes, 'Mobile' ),
426 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_element_css( $attributes, $device ); } )
427 + );
428 + $css_generator->add_class_styles(
429 + '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__icon .ablocks-icon-wrap svg.ablocks-svg-icon',
430 + $this->get_tabs_active_icon_css( $attributes )
431 + );
432 + $css_generator->add_class_styles(
433 + '{{WRAPPER}} .ablocks-block-tabs__icon .ablocks-icon-wrap svg.ablocks-svg-icon:hover',
434 + Icon::get_element_image_hover_css( $attributes ),
435 + Icon::get_element_image_hover_css( $attributes, 'Tablet' ),
436 + Icon::get_element_image_hover_css( $attributes, 'Mobile' ),
437 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_element_image_hover_css( $attributes, $device ); } )
438 + );
439 +
440 + $css_generator->add_class_styles(
441 + '{{WRAPPER}} .ablocks-block-tabs__body',
442 + $this->get_tabs_content_css( $attributes ),
443 + $this->get_tabs_content_css( $attributes, 'Tablet' ),
444 + $this->get_tabs_content_css( $attributes, 'Mobile' ),
445 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_content_css( $attributes, $device ); } )
446 + );
447 +
448 + $css_generator->add_class_styles(
449 + '{{WRAPPER}} .ablocks-block-tabs__body:hover',
450 + $this->get_tabs_content_hover_css( $attributes ),
451 + $this->get_tabs_content_hover_css( $attributes, 'Tablet' ),
452 + $this->get_tabs_content_hover_css( $attributes, 'Mobile' ),
453 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_content_hover_css( $attributes, $device ); } )
454 + );
455 + $css_generator->add_class_styles(
456 + '{{WRAPPER}} .ablocks-block-tabs__tab-menu-content',
457 + $this->get_content_css( $attributes ),
458 + $this->get_content_css( $attributes, 'Tablet' ),
459 + $this->get_content_css( $attributes, 'Mobile' ),
460 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_css( $attributes, $device ); } )
461 + );
462 + $css_generator->add_class_styles(
463 + '{{WRAPPER}} .ablocks-block-tabs__tab-panel',
464 + $this->get_tabs_width_css( $attributes ),
465 + $this->get_tabs_width_css( $attributes, 'Tablet' ),
466 + $this->get_tabs_width_css( $attributes, 'Mobile' ),
467 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_width_css( $attributes, $device ); } )
468 + );
469 + $css_generator->add_class_styles(
470 + '{{WRAPPER}} .ablocks-block-tabs__body',
471 + $this->get_content_width_css( $attributes ),
472 + $this->get_content_width_css( $attributes, 'Tablet' ),
473 + $this->get_content_width_css( $attributes, 'Mobile' ),
474 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_width_css( $attributes, $device ); } )
475 + );
476 +
477 + return $css_generator->generate_css();
478 + }
479 +
480 + public function build_css( $attributes ) {
481 + if ( isset( $attributes['blockVersion'] ) && (int) $attributes['blockVersion'] === 2 ) {
482 + return $this->build_css_v2( $attributes );
483 + }
484 + return $this->build_css_v1( $attributes );
485 + }
486 +
487 +
488 + public function get_tabs_css( $attributes, $device = '' ) {
489 + $tabs_css = [];
490 + $menuPosition = $attributes['tabsMenuPositioning'][ 'value' . $device ] ?? '';
491 +
492 + if ( $menuPosition === 'top' ) {
493 + $tabs_css['flex-direction'] = 'column';
494 + } elseif ( $menuPosition === 'bottom' ) {
495 + $tabs_css['flex-direction'] = 'column-reverse';
496 + } elseif ( $menuPosition === 'left' ) {
497 + $tabs_css['flex-direction'] = 'row';
498 + } elseif ( $menuPosition === 'right' ) {
499 + $tabs_css['flex-direction'] = 'row-reverse';
500 + }
501 + return $tabs_css;
502 + }
503 +
504 + public function get_tabs_panel_css( $attributes, $device = '' ) {
505 + $tabs_panel_css = [];
506 +
507 + $tabMenuAlignment = ! empty( $attributes['tabMenuAlignment'][ 'value' . $device ] ) ? $attributes['tabMenuAlignment'][ 'value' . $device ] : '';
508 + $tabsMenuPositioning = $this->get_responsive_attribute_value( $attributes['tabsMenuPositioning'], $device );
509 + $tabsMenuDirection = $this->get_responsive_attribute_value( $attributes['tabsMenuDirection'], $device );
510 +
511 + // Handle tabMenuAlign for the given device
512 + if ( $tabsMenuPositioning === 'top' || $tabsMenuPositioning === 'bottom' ) {
513 + if ( $tabsMenuDirection === 'row' ) {
514 + $tabs_panel_css['justify-content'] = $tabMenuAlignment;
515 + } elseif ( $tabsMenuDirection === 'column' ) {
516 + $tabs_panel_css['align-items'] = $tabMenuAlignment;
517 + }
518 + if ( $tabMenuAlignment && $attributes['tabsWidthType'][ 'value' . $device ] === 'auto' ) {
519 + if ( $tabMenuAlignment === 'flex-start' ) {
520 + $tabs_panel_css['margin-right'] = 'auto';
521 + } elseif ( $tabMenuAlignment === 'center' ) {
522 + $tabs_panel_css['margin-inline'] = 'auto';
523 + }if ( $tabMenuAlignment === 'flex-end' ) {
524 + $tabs_panel_css['margin-left'] = 'auto';
525 + }
526 + }
527 + }
528 +
529 + if ( $tabsMenuPositioning === 'left' || $tabsMenuPositioning === 'right' ) {
530 + $tabs_panel_css['flex-direction'] = 'column';
531 + } elseif ( $tabsMenuPositioning === 'top' || $tabsMenuPositioning === 'bottom' ) {
532 + $tabs_panel_css['flex-direction'] = $tabsMenuDirection;
533 + if ( ! empty( $attributes['tabWrap'][ 'value' . $device ] ) ) {
534 + $tabs_panel_css['flex-wrap'] = $attributes['tabWrap'][ 'value' . $device ];
535 + }
536 + }
537 +
538 + return array_merge(
539 + $tabs_panel_css,
540 + [ 'background' => Color::get_css( isset( $attributes['tabMenusBackgroundColor'] ) ? $attributes['tabMenusBackgroundColor'] : '' ) ],
541 + Dimensions::get_css( $attributes['tabMenusMargin'] ?? [], 'margin', $device ),
542 + Dimensions::get_css( $attributes['tabMenusPadding'] ?? [], 'padding', $device ),
543 + Border::get_css( $attributes['tabMenusBorder'] ?? [], '', $device ),
544 + Range::get_css([
545 + 'attributeValue' => $attributes['tabsGap'],
546 + 'attribute_object_key' => 'value',
547 + 'isResponsive' => true,
548 + 'defaultValue' => 10,
549 + 'hasUnit' => true,
550 + 'unitDefaultValue' => 'px',
551 + 'property' => 'gap',
552 + 'device' => $device,
553 + ]),
554 + );
555 + }
556 +
557 + public function get_tabs_panel_hover_css( $attributes, $device = '' ) {
558 +
559 + return array_merge(
560 + Border::get_hover_css( $attributes['tabMenusBorder'] ?? [], '', $device ),
561 + );
562 + }
563 +
564 + public function get_tabs_menu_content_css( $attributes, $device = '' ) {
565 + $css = [];
566 + $css['display'] = 'flex';
567 +
568 + $iconPosition = $this->get_responsive_attribute_value( $attributes['iconPosition'], $device );
569 + $tabsMenuPositioning = $this->get_responsive_attribute_value( $attributes['tabsMenuPositioning'], $device );
570 + $tabsContentWidthType = ! empty( $attributes['tabsContentWidthType'][ 'value' . $device ] ) ? $attributes['tabsContentWidthType'][ 'value' . $device ] : '';
571 + $tabsMenuDirection = ! empty( $attributes['tabsMenuDirection'][ 'value' . $device ] ) ? $attributes['tabsMenuDirection'][ 'value' . $device ] : '';
572 +
573 + if ( ( $tabsMenuPositioning === 'top' || $tabsMenuPositioning === 'bottom' ) && $tabsContentWidthType === '100%' ) {
574 + $css['width'] = '100%';
575 + }
576 +
577 + // Handling icon position
578 + if ( $iconPosition === 'top' ) {
579 + $css['flex-direction'] = 'column';
580 + if ( isset( $attributes['menuContentAlignment'][ 'value' . $device ] ) ) {
581 + $css['align-items'] = $attributes['menuContentAlignment'][ 'value' . $device ];
582 + }
583 + }
584 + if ( $iconPosition === 'bottom' ) {
585 + $css['flex-direction'] = 'column-reverse';
586 + if ( isset( $attributes['menuContentAlignment'][ 'value' . $device ] ) ) {
587 + $css['align-items'] = $attributes['menuContentAlignment'][ 'value' . $device ];
588 + }
589 + }
590 + if ( $iconPosition === 'left' ) {
591 + $css['flex-direction'] = 'row';
592 + $css['align-items'] = 'center';
593 + if ( isset( $attributes['menuContentAlignment'][ 'value' . $device ] ) ) {
594 + $css['justify-content'] = $attributes['menuContentAlignment'][ 'value' . $device ];
595 + }
596 + }
597 + if ( $iconPosition === 'right' ) {
598 + $css['flex-direction'] = 'row-reverse';
599 + $css['align-items'] = 'center';
600 + if ( isset( $attributes['menuContentAlignment'][ 'value' . $device ] ) ) {
601 + $css['justify-content'] = $attributes['menuContentAlignment'][ 'value' . $device ];
602 + }
603 + }
604 +
605 + // Merging with margin, padding, and border styles
606 + return array_merge(
607 + [ 'background' => Color::get_css( isset( $attributes['tabBackgroundColor'] ) ? $attributes['tabBackgroundColor'] : '' ) ],
608 + $css,
609 + Dimensions::get_css( $attributes['menuContentPadding'] ?? [], 'padding', $device ),
610 + Border::get_css( $attributes['menuContentBorder'] ?? [], '', $device ),
611 + BoxShadow::get_css( $attributes['boxShadow'], '', $device ),
612 + );
613 + }
614 +
615 +
616 + public function get_tabs_menu_content_active_css( $attributes, $device = '' ) {
617 + $tabs_menu_content_active_css = [];
618 +
619 + if ( isset( $attributes['activeColorOptions'] ) && $attributes['activeColorOptions'] === 'background' ) {
620 + if ( isset( $attributes['tabActiveBackgroundColor'] ) ) {
621 + $tabs_menu_content_active_css['background-color'] = Color::get_css( isset( $attributes['tabActiveBackgroundColor'] ) ? $attributes['tabActiveBackgroundColor'] : '' ) . ' !important';
622 + }
623 + } elseif ( isset( $attributes['activeColorOptions'] ) && $attributes['activeColorOptions'] === 'border' ) {
624 + if ( isset( $attributes['activeBorderColor'] ) ) {
625 + $tabs_menu_content_active_css['border-color'] = Color::get_css( isset( $attributes['activeBorderColor'] ) ? $attributes['activeBorderColor'] : '' ) . ' !important';
626 + }
627 + }
628 +
629 + return $tabs_menu_content_active_css;
630 + }
631 +
632 +
633 + public function get_tabs_menu_content_hover_css( $attributes, $device = '' ) {
634 +
635 + return array_merge(
636 + Border::get_hover_css( $attributes['menuContentBorder'] ?? [], '', $device ),
637 + BoxShadow::get_hover_css( $attributes['boxShadow'], '', $device )
638 + );
639 + }
640 + public function get_tabs_title_css( $attributes, $device = '' ) {
641 + $typographyValueGlobal = ! empty( $attributes['titleTypographyGlobal'] ) ? $attributes['titleTypographyGlobal'] : [];
642 + return array_merge(
643 + [ 'color' => Color::get_css( isset( $attributes['titleTextColor'] ) ? $attributes['titleTextColor'] : '' ) ],
644 + Typography::get_css( $attributes['titleTypography'] ?? [], '', $device, $typographyValueGlobal ));
645 + }
646 +
647 + public function get_tabs_active_title_css( $attributes, $device = '' ) {
648 +
649 + return [ 'color' => Color::get_css( isset( $attributes['titleTextActiveColor'] ) ? $attributes['titleTextActiveColor'] : '' ) ];
650 + }
651 +
652 + public function get_tabs_subtitle_css( $attributes, $device = '' ) {
653 + $tabsSubtitleCSS = [];
654 + if ( isset( $attributes['showActiveSubTitle'] ) && $attributes['showActiveSubTitle'] === true ) {
655 + $tabsSubtitleCSS['display'] = 'none';
656 + }
657 + // Get typography styles
658 + $typographyValueGlobal = ! empty( $attributes['subTitleTypographyGlobal'] ) ? $attributes['subTitleTypographyGlobal'] : [];
659 + $typographyStyles = Typography::get_css( $attributes['subTitleTypography'] ?? [], '', $device, $typographyValueGlobal );
660 + $tabsSubtitleCSS = array_merge( $tabsSubtitleCSS, $typographyStyles );
661 +
662 + // Determine width based on menu position
663 + $tabsContentWidthType = $this->get_responsive_attribute_value( $attributes['tabsContentWidthType'], $device );
664 + $position = $this->get_responsive_attribute_value( $attributes['tabsMenuPositioning'], $device );
665 + if ( $device === 'Mobile' ) {
666 + $tabsSubtitleCSS['width'] = '100%';
667 + } elseif ( ( $position === 'top' || $position === 'bottom' ) && $tabsContentWidthType === 'auto' ) {
668 + $tabsSubtitleCSS['max-width'] = '160px';
669 + }
670 +
671 + return array_merge(
672 + [ 'color' => Color::get_css( isset( $attributes['subTitleTextColor'] ) ? $attributes['subTitleTextColor'] : '' ) ],
673 + $tabsSubtitleCSS
674 + );
675 + }
676 +
677 +
678 + public function get_tabs_active_subtitle_text_css( $attributes, $device = '' ) {
679 + $css = [];
680 + if ( isset( $attributes['showActiveSubTitle'] ) && $attributes['showActiveSubTitle'] === true ) {
681 + $css['display'] = 'block';
682 + }
683 + if ( isset( $attributes['subTitleTextActiveColor'] ) ) {
684 + $css['color'] = Color::get_css( isset( $attributes['subTitleTextActiveColor'] ) ? $attributes['subTitleTextActiveColor'] : '' ) . '!important';
685 + }
686 + return $css;
687 + }
688 + public function get_icon_position_css( $attributes, $device = '' ) {
689 + return array_merge(
690 + Dimensions::get_css( $attributes['iconPositionMargin'] ?? [], 'margin', $device )
691 + );
692 + }
693 + public function progress_bar_style_css( $attributes, $device = '' ) {
694 + return [ 'background' => Color::get_css( isset( $attributes['progressBarColor'] ) ? $attributes['progressBarColor'] : '' ) ];
695 + }
696 +
697 + public function get_tabs_icon_css( $attributes, $device = '' ) {
698 + $css = [];
699 + $iconType = $attributes['iconType'] ?? 'default';
700 + $iconShape = $attributes['iconShape'] ?? 'square';
701 + $iconColor = $attributes['iconColor'] ?? '#69727d';
702 + $iconBackground = $attributes['iconBackground'] ?? 'transparent';
703 + $size = $attributes['size'][ 'value' . $device ] ?? null;
704 + $spacing = $attributes['spacing'][ 'value' . $device ] ?? null;
705 + $iconPosition = $attributes['iconPosition'] ?? '';
706 +
707 + // Determine icon view CSS based on type and shape
708 + $iconViewCSS = [];
709 +
710 + if ( $iconType !== 'default' ) {
711 + if ( $iconType === 'stacked' ) {
712 + $iconViewCSS['background'] = $iconBackground;
713 + $iconViewCSS['padding'] = '.5em';
714 +
715 + if ( $iconShape === 'circle' ) {
716 + $iconViewCSS['border-radius'] = '50px';
717 + }
718 + } elseif ( $iconType === 'framed' ) {
719 + $iconViewCSS['background'] = 'transparent';
720 + $iconViewCSS['padding'] = '.5em';
721 + $iconViewCSS['border'] = '2px solid ' . ( $iconColor ? $iconColor : '#69727d' );
722 +
723 + if ( $iconShape === 'circle' ) {
724 + $iconViewCSS['border-radius'] = '50px';
725 + }
726 + }
727 + }
728 +
729 + // Apply size CSS if available
730 + if ( $size ) {
731 + $css['width'] = $size . 'px !important';
732 + $css['height'] = $size . 'px !important';
733 + }
734 + // Apply spacing based on position
735 + if ( $spacing ) {
736 + switch ( $iconPosition ) {
737 + case 'left':
738 + $css['margin-right'] = $spacing . 'px';
739 + break;
740 + case 'right':
741 + $css['margin-left'] = $spacing . 'px';
742 + break;
743 + case 'bottom':
744 + $css['margin-top'] = $spacing . 'px';
745 + break;
746 + case 'top':
747 + $css['margin-bottom'] = $spacing . 'px';
748 + break;
749 + }
750 + }
751 + // Merge the icon view CSS with the main CSS
752 + return array_merge(
753 + [ 'fill' => Color::get_css( isset( $attributes['iconColor'] ) ? $attributes['iconColor'] : '' ) ],
754 + $css,
755 + $iconViewCSS );
756 + }
757 +
758 + // The active tab's icon follows the title active colour.
759 + public function get_tabs_active_icon_css( $attributes ) {
760 + $css = [];
761 + if ( ! empty( $attributes['titleTextActiveColor'] ) ) {
762 + $css['fill'] = Color::get_css( $attributes['titleTextActiveColor'] );
763 + }
764 + return $css;
765 + }
766 +
767 + public function get_tabs_content_css( $attributes, $device = '' ) {
768 + $tabs_content_css = [];
769 + // Merge margin, padding, and border CSS
770 + $tabs_content_css = array_merge(
771 + [ 'background' => Color::get_css( isset( $attributes['contentBackgroundColor'] ) ? $attributes['contentBackgroundColor'] : '' ) ],
772 + $tabs_content_css,
773 + Dimensions::get_css( $attributes['contentMargin'] ?? [], 'margin', $device ),
774 + Dimensions::get_css( $attributes['contentPadding'] ?? [], 'padding', $device ),
775 + Border::get_css( $attributes['contentBorder'] ?? [], '', $device )
776 + );
777 + // Apply max-width based on device and tabsMenuPosition
778 + if ( $device === 'Mobile' ) {
779 + $tabs_content_css['max-width'] = '100%';
780 + } else {
781 + $menuPosition = $attributes['tabsMenuPositioning'][ 'value' . $device ] ?? '';
782 + if ( $menuPosition === 'top' || $menuPosition === 'bottom' ) {
783 + $tabs_content_css['max-width'] = '100% !important';
784 + } elseif ( $menuPosition === 'left' || $menuPosition === 'right' ) {
785 + $tabs_content_css['max-width'] = '70%';
786 + $tabs_content_css['flex-grow'] = 3;
787 + }
788 + }
789 +
790 + return $tabs_content_css;
791 + }
792 +
793 +
794 + public function get_tabs_content_hover_css( $attributes, $device = '' ) {
795 + return array_merge(
796 + Border::get_hover_css( $attributes['contentBorder'] ?? [], '', $device ),
797 + );
798 + }
799 +
800 + public function get_content_css( $attributes, $device = '' ) {
801 + $css = [];
802 + if ( isset( $attributes['menuContentAlignment'][ 'value' . $device ] ) ) {
803 + $css['text-align'] = $attributes['menuContentAlignment'][ 'value' . $device ];
804 + }
805 + return array_merge(
806 + Range::get_css([
807 + 'attributeValue' => $attributes['contentGap'],
808 + 'attribute_object_key' => 'value',
809 + 'isResponsive' => true,
810 + 'defaultValue' => 10,
811 + 'hasUnit' => true,
812 + 'unitDefaultValue' => 'px',
813 + 'property' => 'gap',
814 + 'device' => $device,
815 + ]),
816 + $css,
817 + );
818 + }
819 + public function get_tabs_width_css( $attributes, $device = '' ) {
820 + $css = [];
821 +
822 + $tabsWidthType = $this->get_responsive_attribute_value( $attributes['tabsWidthType'], $device );
823 + $tabsMenuPositioning = $this->get_responsive_attribute_value( $attributes['tabsMenuPositioning'], $device );
824 +
825 + if (
826 + $tabsMenuPositioning === 'top' ||
827 + $tabsMenuPositioning === 'bottom'
828 + ) {
829 + $css['width'] = $tabsWidthType;
830 + return $css;
831 + }
832 +
833 + if (
834 + $tabsMenuPositioning === 'left' ||
835 + $tabsMenuPositioning === 'right'
836 + ) {
837 + return array_merge(
838 + Range::get_css([
839 + 'attributeValue' => $attributes['tabsWidth'],
840 + 'attribute_object_key' => 'value',
841 + 'isResponsive' => true,
842 + 'defaultValue' => 30,
843 + 'hasUnit' => false,
844 + 'unitDefaultValue' => '%',
845 + 'property' => 'width',
846 + 'device' => $device,
847 + ]),
848 + );
849 + }
850 + }
851 +
852 + public function get_content_width_css( $attributes, $device = '' ) {
853 + $css = [];
854 + if (
855 + isset( $attributes['tabsMenuPositioning'][ 'value' . $device ] ) &&
856 + (
857 + $attributes['tabsMenuPositioning'][ 'value' . $device ] === 'top' ||
858 + $attributes['tabsMenuPositioning'][ 'value' . $device ] === 'bottom'
859 + )
860 + ) {
861 + $css['max-width'] = '100% !important';
862 + }
863 + return array_merge(
864 + Range::get_css([
865 + 'attributeValue' => $attributes['contentWidth'],
866 + 'attribute_object_key' => 'value',
867 + 'isResponsive' => true,
868 + 'defaultValue' => 70,
869 + 'hasUnit' => false,
870 + 'unitDefaultValue' => '%',
871 + 'property' => 'max-width',
872 + 'device' => $device,
873 + ]),
874 + $css,
875 + );
876 + }
877 + public function get_icon_spacing_css( $attributes, $device = '' ) {
878 + $spacing_css = [];
879 +
880 + if ( isset( $attributes['iconPosition'][ 'value' . $device ] ) ) {
881 + $position = $attributes['iconPosition'][ 'value' . $device ];
882 +
883 + if ( $position === 'left' ) {
884 + $spacing_css = Range::get_css([
885 + 'attributeValue' => $attributes['spacing'] ?? null,
886 + 'attributeObjectKey' => 'value',
887 + 'defaultValue' => 0,
888 + 'isResponsive' => true,
889 + 'hasUnit' => true,
890 + 'property' => 'margin-right',
891 + 'unitDefaultValue' => 'px',
892 + ]);
893 + } elseif ( $position === 'right' ) {
894 + $spacing_css = Range::get_css([
895 + 'attributeValue' => $attributes['spacing'] ?? null,
896 + 'attributeObjectKey' => 'value',
897 + 'defaultValue' => 0,
898 + 'isResponsive' => true,
899 + 'hasUnit' => true,
900 + 'property' => 'margin-left',
901 + 'unitDefaultValue' => 'px',
902 + ]);
903 + } elseif ( $position === 'bottom' ) {
904 + $spacing_css = Range::get_css([
905 + 'attributeValue' => $attributes['spacing'] ?? null,
906 + 'attributeObjectKey' => 'value',
907 + 'defaultValue' => 0,
908 + 'isResponsive' => true,
909 + 'hasUnit' => true,
910 + 'property' => 'margin-top',
911 + 'unitDefaultValue' => 'px',
912 + ]);
913 + } elseif ( $position === 'top' ) {
914 + $spacing_css = Range::get_css([
915 + 'attributeValue' => $attributes['spacing'] ?? null,
916 + 'attributeObjectKey' => 'value',
917 + 'defaultValue' => 0,
918 + 'isResponsive' => true,
919 + 'hasUnit' => true,
920 + 'property' => 'margin-bottom',
921 + 'unitDefaultValue' => 'px',
922 + ]);
923 + }//end if
924 + }//end if
925 +
926 + return $spacing_css;
927 + }
928 +
929 + // don't delete this function, it's used in the render method to get responsive attribute values
930 + public function get_responsive_attribute_value( $attribute, $device ) {
931 +
932 + if ( $device === 'Mobile' ) {
933 + return ! empty( $attribute['valueMobile'] ) ? $attribute['valueMobile']
934 + : ( ! empty( $attribute['valueTablet'] ) ? $attribute['valueTablet']
935 + : ( $attribute['value'] ?? '' ) );
936 + }
937 +
938 + if ( $device === 'Tablet' ) {
939 + return ! empty( $attribute['valueTablet'] ) ? $attribute['valueTablet']
940 + : ( $attribute['value'] ?? '' );
941 + }
942 +
943 + // Default (Desktop or others)
944 + return $attribute['value'] ?? '';
945 + }
946 +
947 +
948 +
949 +}