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 +465 -239 2.9.1 → 2.14.0 View file →
@@ -1,10 +1,15 @@
1 1 <?php
2 2
3 3 namespace ABlocks\Blocks\Tabs;
4 4
5 +if ( ! defined( 'ABSPATH' ) ) {
6 + exit;
7 +}
8 +
5 9 use ABlocks\Classes\BlockBaseAbstract;
6 10 use ABlocks\Classes\CssGenerator;
11 +use ABlocks\Classes\CssGeneratorV2;
7 12 use ABlocks\Controls\Typography;
8 13 use ABlocks\Controls\Dimensions;
9 14 use ABlocks\Controls\Border;
10 15 use ABlocks\Controls\Icon;
@@ -9,14 +14,16 @@
9 14 use ABlocks\Controls\Border;
10 15 use ABlocks\Controls\Icon;
11 16 use ABlocks\Controls\BoxShadow;
12 17 use ABlocks\Controls\Range;
18 +use ABlocks\Controls\Color;
13 19
20 +
14 21 class Block extends BlockBaseAbstract {
15 22
16 23 protected $block_name = 'tabs';
17 24
18 - public function build_css( $attributes ) {
25 + public function build_css_v1( $attributes ) {
19 26 $css_generator = new CssGenerator( $attributes, $this->block_name );
20 27
21 28 $css_generator->add_class_styles(
22 29 '{{WRAPPER}} .ablocks-block-tabs',
@@ -21,23 +28,33 @@
21 28 $css_generator->add_class_styles(
22 29 '{{WRAPPER}} .ablocks-block-tabs',
23 30 $this->get_tabs_css( $attributes ),
24 31 $this->get_tabs_css( $attributes, 'Tablet' ),
25 - $this->get_tabs_css( $attributes, 'Mobile' )
32 + $this->get_tabs_css( $attributes, 'Mobile' ),
33 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_tabs_css( $attributes, $device ); } )
26 34 );
27 -
28 35 $css_generator->add_class_styles(
29 36 '{{WRAPPER}} .ablocks-block-tabs__tab-panel',
30 37 $this->get_tabs_panel_css( $attributes ),
31 38 $this->get_tabs_panel_css( $attributes, 'Tablet' ),
32 - $this->get_tabs_panel_css( $attributes, 'Mobile' )
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 ); } )
33 41 );
34 42
35 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(
36 52 '{{WRAPPER}} .ablocks-block-tabs__tab',
37 53 $this->get_tabs_menu_content_css( $attributes ),
38 54 $this->get_tabs_menu_content_css( $attributes, 'Tablet' ),
39 - $this->get_tabs_menu_content_css( $attributes, 'Mobile' )
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 ); } )
40 57 );
41 58
42 59 $css_generator->add_class_styles(
43 60 '{{WRAPPER}} .ablocks-block-tabs__tab--active',
@@ -42,9 +59,10 @@
42 59 $css_generator->add_class_styles(
43 60 '{{WRAPPER}} .ablocks-block-tabs__tab--active',
44 61 $this->get_tabs_menu_content_active_css( $attributes ),
45 62 $this->get_tabs_menu_content_active_css( $attributes, 'Tablet' ),
46 - $this->get_tabs_menu_content_active_css( $attributes, 'Mobile' )
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 ); } )
47 65 );
48 66
49 67 $css_generator->add_class_styles(
50 68 '{{WRAPPER}} .ablocks-block-tabs__tab:hover',
@@ -49,15 +67,17 @@
49 67 $css_generator->add_class_styles(
50 68 '{{WRAPPER}} .ablocks-block-tabs__tab:hover',
51 69 $this->get_tabs_menu_content_hover_css( $attributes ),
52 70 $this->get_tabs_menu_content_hover_css( $attributes, 'Tablet' ),
53 - $this->get_tabs_menu_content_hover_css( $attributes, 'Mobile' )
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 ); } )
54 73 );
55 74 $css_generator->add_class_styles(
56 75 '{{WRAPPER}} .ablocks-block-tabs__tab-menu-title',
57 76 $this->get_tabs_title_css( $attributes ),
58 77 $this->get_tabs_title_css( $attributes, 'Tablet' ),
59 - $this->get_tabs_title_css( $attributes, 'Mobile' )
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 ); } )
60 80 );
61 81
62 82 $css_generator->add_class_styles(
63 83 '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__tab-menu-title',
@@ -62,9 +82,10 @@
62 82 $css_generator->add_class_styles(
63 83 '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__tab-menu-title',
64 84 $this->get_tabs_active_title_css( $attributes ),
65 85 $this->get_tabs_active_title_css( $attributes, 'Tablet' ),
66 - $this->get_tabs_active_title_css( $attributes, 'Mobile' )
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 ); } )
67 88 );
68 89
69 90 $css_generator->add_class_styles(
70 91 '{{WRAPPER}} .ablocks-block-tabs__tab-menu-subtitle',
@@ -69,9 +90,10 @@
69 90 $css_generator->add_class_styles(
70 91 '{{WRAPPER}} .ablocks-block-tabs__tab-menu-subtitle',
71 92 $this->get_tabs_subtitle_css( $attributes ),
72 93 $this->get_tabs_subtitle_css( $attributes, 'Tablet' ),
73 - $this->get_tabs_subtitle_css( $attributes, 'Mobile' )
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 ); } )
74 96 );
75 97
76 98 $css_generator->add_class_styles(
77 99 '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__tab-menu-subtitle',
@@ -76,9 +98,10 @@
76 98 $css_generator->add_class_styles(
77 99 '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__tab-menu-subtitle',
78 100 $this->get_tabs_active_subtitle_text_css( $attributes ),
79 101 $this->get_tabs_active_subtitle_text_css( $attributes, 'Tablet' ),
80 - $this->get_tabs_active_subtitle_text_css( $attributes, 'Mobile' )
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 ); } )
81 104 );
82 105 if ( isset( $attributes['showActiveSubTitle'] ) && $attributes['showActiveSubTitle'] === false ) {
83 106 $css_generator->add_class_styles(
84 107 '{{WRAPPER}} .ablocks-block-tabs__icon',
@@ -83,9 +106,10 @@
83 106 $css_generator->add_class_styles(
84 107 '{{WRAPPER}} .ablocks-block-tabs__icon',
85 108 $this->get_icon_position_css( $attributes ),
86 109 $this->get_icon_position_css( $attributes, 'Tablet' ),
87 - $this->get_icon_position_css( $attributes, 'Mobile' )
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 ); } )
88 112 );
89 113 } else {
90 114 $css_generator->add_class_styles(
91 115 '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__icon',
@@ -90,9 +114,10 @@
90 114 $css_generator->add_class_styles(
91 115 '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__icon',
92 116 $this->get_icon_position_css( $attributes ),
93 117 $this->get_icon_position_css( $attributes, 'Tablet' ),
94 - $this->get_icon_position_css( $attributes, 'Mobile' )
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 ); } )
95 120 );
96 121 }
97 122 $css_generator->add_class_styles(
98 123 '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__progressbar',
@@ -97,9 +122,10 @@
97 122 $css_generator->add_class_styles(
98 123 '{{WRAPPER}} .ablocks-block-tabs__tab--active .ablocks-block-tabs__progressbar',
99 124 $this->progress_bar_style_css( $attributes ),
100 125 $this->progress_bar_style_css( $attributes, 'Tablet' ),
101 - $this->progress_bar_style_css( $attributes, 'Mobile' )
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 ); } )
102 128 );
103 129 $tabs_element_icon_wrapper_styles = Icon::get_wrapper_css( $attributes );
104 130
105 131 $spacing_value = [];
@@ -175,8 +201,14 @@
175 201 $tablet_styles,
176 202 $mobile_styles
177 203 );
178 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 + );
179 211
180 212 $css_generator->add_class_styles(
181 213 '{{WRAPPER}} .ablocks-block-tabs__icon .ablocks-icon-wrap img.ablocks-image-icon',
182 214 Icon::get_element_image_css( $attributes ),
@@ -195,8 +227,12 @@
195 227 Icon::get_element_css( $attributes, 'Tablet' ),
196 228 Icon::get_element_css( $attributes, 'Mobile' ),
197 229 );
198 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(
199 235 '{{WRAPPER}} .ablocks-block-tabs__icon .ablocks-icon-wrap svg.ablocks-svg-icon:hover',
200 236 Icon::get_element_image_hover_css( $attributes ),
201 237 Icon::get_element_image_hover_css( $attributes, 'Tablet' ),
202 238 Icon::get_element_image_hover_css( $attributes, 'Mobile' ),
@@ -205,9 +241,10 @@
205 241 $css_generator->add_class_styles(
206 242 '{{WRAPPER}} .ablocks-block-tabs__body',
207 243 $this->get_tabs_content_css( $attributes ),
208 244 $this->get_tabs_content_css( $attributes, 'Tablet' ),
209 - $this->get_tabs_content_css( $attributes, 'Mobile' )
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 ); } )
210 247 );
211 248
212 249 $css_generator->add_class_styles(
213 250 '{{WRAPPER}} .ablocks-block-tabs__body:hover',
@@ -212,59 +249,256 @@
212 249 $css_generator->add_class_styles(
213 250 '{{WRAPPER}} .ablocks-block-tabs__body:hover',
214 251 $this->get_tabs_content_hover_css( $attributes ),
215 252 $this->get_tabs_content_hover_css( $attributes, 'Tablet' ),
216 - $this->get_tabs_content_hover_css( $attributes, 'Mobile' )
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 ); } )
217 255 );
218 256 $css_generator->add_class_styles(
219 257 '{{WRAPPER}} .ablocks-block-tabs__tab-menu-content',
220 258 $this->get_content_css( $attributes ),
221 259 $this->get_content_css( $attributes, 'Tablet' ),
222 - $this->get_content_css( $attributes, 'Mobile' )
260 + $this->get_content_css( $attributes, 'Mobile' ),
261 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_css( $attributes, $device ); } )
223 262 );
224 263 $css_generator->add_class_styles(
225 264 '{{WRAPPER}} .ablocks-block-tabs__tab-panel',
226 265 $this->get_tabs_width_css( $attributes ),
227 266 $this->get_tabs_width_css( $attributes, 'Tablet' ),
228 - $this->get_tabs_width_css( $attributes, 'Mobile' )
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 ); } )
229 269 );
230 270 $css_generator->add_class_styles(
231 271 '{{WRAPPER}} .ablocks-block-tabs__body',
232 272 $this->get_content_width_css( $attributes ),
233 273 $this->get_content_width_css( $attributes, 'Tablet' ),
234 - $this->get_content_width_css( $attributes, 'Mobile' )
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 ); } )
235 276 );
236 277
237 278 return $css_generator->generate_css();
238 279 }
280 + public function build_css_v2( $attributes ) {
281 + $css_generator = new CssGeneratorV2( $attributes, $this->block_name );
239 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 + );
240 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 +
241 488 public function get_tabs_css( $attributes, $device = '' ) {
242 489 $tabs_css = [];
243 -
244 - // Determine the tabs menu position for the given device
245 490 $menuPosition = $attributes['tabsMenuPositioning'][ 'value' . $device ] ?? '';
246 491
247 - // Apply CSS rules based on the device type and menu position
248 - if ( $device === 'Mobile' ) {
249 - if ( empty( $menuPosition ) || $menuPosition === 'left' || $menuPosition === 'top' ) {
250 - $tabs_css['flex-direction'] = 'column';
251 - } elseif ( $menuPosition === 'right' || $menuPosition === 'bottom' ) {
252 - $tabs_css['flex-direction'] = 'column-reverse';
253 - }
254 - } else {
255 - // For desktop and tablet
256 - if ( $menuPosition === 'top' ) {
257 - $tabs_css['flex-direction'] = 'column';
258 - } elseif ( $menuPosition === 'bottom' ) {
259 - $tabs_css['flex-direction'] = 'column-reverse';
260 - } elseif ( $menuPosition === 'right' ) {
261 - $tabs_css['flex-direction'] = 'row-reverse';
262 - } elseif ( $menuPosition === 'left' ) {
263 - $tabs_css['flex-direction'] = 'row';
264 - }
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';
265 500 }
266 -
267 501 return $tabs_css;
268 502 }
269 503
270 504 public function get_tabs_panel_css( $attributes, $device = '' ) {
@@ -269,49 +503,92 @@
269 503
270 504 public function get_tabs_panel_css( $attributes, $device = '' ) {
271 505 $tabs_panel_css = [];
272 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 +
273 511 // Handle tabMenuAlign for the given device
274 - if ( isset( $attributes['tabMenuAlignment'][ 'value' . $device ] ) ) {
275 - $tabs_panel_css['justify-content'] = $attributes['tabMenuAlignment'][ 'value' . $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 + }
276 527 }
277 528
278 - // Determine the tabsMenuPosition and apply styles accordingly
279 - $tabsMenuPosition = $attributes['tabsMenuPositioning'][ 'value' . $device ] ?? '';
280 -
281 - if ( $tabsMenuPosition === 'top' || $tabsMenuPosition === 'bottom' ) {
282 - // For column layout
283 - $tabs_panel_css['flex-direction'] = ( $device === 'Tablet' || $device === 'Mobile' ) ? 'column' : 'row';
284 - $tabs_panel_css['max-width'] = '100%';
285 - $tabs_panel_css['flex-wrap'] = 'wrap';
286 - } elseif ( empty( $tabsMenuPosition ) || $tabsMenuPosition === 'left' || $tabsMenuPosition === 'right' ) {
287 - // For row layout
529 + if ( $tabsMenuPositioning === 'left' || $tabsMenuPositioning === 'right' ) {
288 530 $tabs_panel_css['flex-direction'] = 'column';
289 - $tabs_panel_css['max-width'] = ( $device === 'Mobile' ) ? '100%' : '30%';
290 - $tabs_panel_css['min-width'] = ( $device === 'Mobile' ) ? '100%' : '30%';
291 - $tabs_panel_css['flex-grow'] = 1;
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 + }
292 536 }
293 537
294 - return $tabs_panel_css;
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 + );
295 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 +
296 564 public function get_tabs_menu_content_css( $attributes, $device = '' ) {
297 565 $css = [];
298 566 $css['display'] = 'flex';
299 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 +
300 577 // Handling icon position
301 - if ( isset( $attributes['iconPosition'] ) && $attributes['iconPosition'] === 'top' ) {
578 + if ( $iconPosition === 'top' ) {
302 579 $css['flex-direction'] = 'column';
303 580 if ( isset( $attributes['menuContentAlignment'][ 'value' . $device ] ) ) {
304 581 $css['align-items'] = $attributes['menuContentAlignment'][ 'value' . $device ];
305 582 }
306 583 }
307 - if ( isset( $attributes['iconPosition'] ) && $attributes['iconPosition'] === 'bottom' ) {
584 + if ( $iconPosition === 'bottom' ) {
308 585 $css['flex-direction'] = 'column-reverse';
309 586 if ( isset( $attributes['menuContentAlignment'][ 'value' . $device ] ) ) {
310 587 $css['align-items'] = $attributes['menuContentAlignment'][ 'value' . $device ];
311 588 }
312 589 }
313 - if ( isset( $attributes['iconPosition'] ) && $attributes['iconPosition'] === 'left' ) {
590 + if ( $iconPosition === 'left' ) {
314 591 $css['flex-direction'] = 'row';
315 592 $css['align-items'] = 'center';
316 593 if ( isset( $attributes['menuContentAlignment'][ 'value' . $device ] ) ) {
317 594 $css['justify-content'] = $attributes['menuContentAlignment'][ 'value' . $device ];
@@ -316,9 +593,9 @@
316 593 if ( isset( $attributes['menuContentAlignment'][ 'value' . $device ] ) ) {
317 594 $css['justify-content'] = $attributes['menuContentAlignment'][ 'value' . $device ];
318 595 }
319 596 }
320 - if ( isset( $attributes['iconPosition'] ) && $attributes['iconPosition'] === 'right' ) {
597 + if ( $iconPosition === 'right' ) {
321 598 $css['flex-direction'] = 'row-reverse';
322 599 $css['align-items'] = 'center';
323 600 if ( isset( $attributes['menuContentAlignment'][ 'value' . $device ] ) ) {
324 601 $css['justify-content'] = $attributes['menuContentAlignment'][ 'value' . $device ];
@@ -324,95 +601,12 @@
324 601 $css['justify-content'] = $attributes['menuContentAlignment'][ 'value' . $device ];
325 602 }
326 603 }
327 604
328 - // Tab background color
329 - if ( isset( $attributes['tabBackgroundColor'] ) ) {
330 - $css['background-color'] = $attributes['tabBackgroundColor'];
331 - }
332 -
333 - // Handling tabs gap
334 - $tabs_gap_value = [];
335 - $tabs_menu_position = $attributes['tabsMenuPositioning'][ 'value' . $device ] ?? '';
336 -
337 - if ( ( $tabs_menu_position === 'left' || $tabs_menu_position === 'right' ) ) {
338 - $tabs_gap_value = array_merge(
339 - Range::get_css([
340 - 'attributeValue' => $attributes['tabsGap'],
341 - 'attribute_object_key' => 'value',
342 - 'isResponsive' => true,
343 - 'defaultValue' => 10,
344 - 'hasUnit' => true,
345 - 'unitDefaultValue' => 'px',
346 - 'property' => 'margin-top',
347 - 'device' => $device,
348 - ]),
349 - Range::get_css([
350 - 'attributeValue' => $attributes['tabsGap'],
351 - 'attribute_object_key' => 'value',
352 - 'isResponsive' => true,
353 - 'defaultValue' => 10,
354 - 'hasUnit' => true,
355 - 'unitDefaultValue' => 'px',
356 - 'property' => 'margin-bottom',
357 - 'device' => $device,
358 - ]),
359 - );
360 - }//end if
361 - if ( ( $tabs_menu_position === 'top' || $tabs_menu_position === 'bottom' ) ) {
362 - if ( $device === 'Tablet' || $device === 'Mobile' ) {
363 - $tabs_gap_value = array_merge(
364 - Range::get_css([
365 - 'attributeValue' => $attributes['tabsGap'],
366 - 'attribute_object_key' => 'value',
367 - 'isResponsive' => true,
368 - 'defaultValue' => 10,
369 - 'hasUnit' => true,
370 - 'unitDefaultValue' => 'px',
371 - 'property' => 'margin-top',
372 - 'device' => $device,
373 - ]),
374 - Range::get_css([
375 - 'attributeValue' => $attributes['tabsGap'],
376 - 'attribute_object_key' => 'value',
377 - 'isResponsive' => true,
378 - 'defaultValue' => 10,
379 - 'hasUnit' => true,
380 - 'unitDefaultValue' => 'px',
381 - 'property' => 'margin-bottom',
382 - 'device' => $device,
383 - ]),
384 - );
385 - } else {
386 - $tabs_gap_value = array_merge(
387 - Range::get_css([
388 - 'attributeValue' => $attributes['tabsGap'],
389 - 'attribute_object_key' => 'value',
390 - 'isResponsive' => true,
391 - 'defaultValue' => 10,
392 - 'hasUnit' => true,
393 - 'unitDefaultValue' => 'px',
394 - 'property' => 'margin-left',
395 - 'device' => $device,
396 - ]),
397 - Range::get_css([
398 - 'attributeValue' => $attributes['tabsGap'],
399 - 'attribute_object_key' => 'value',
400 - 'isResponsive' => true,
401 - 'defaultValue' => 10,
402 - 'hasUnit' => true,
403 - 'unitDefaultValue' => 'px',
404 - 'property' => 'margin-right',
405 - 'device' => $device,
406 - ]),
407 - );
408 - }//end if
409 - }//end if
410 -
411 605 // Merging with margin, padding, and border styles
412 606 return array_merge(
607 + [ 'background' => Color::get_css( isset( $attributes['tabBackgroundColor'] ) ? $attributes['tabBackgroundColor'] : '' ) ],
413 608 $css,
414 - $tabs_gap_value,
415 609 Dimensions::get_css( $attributes['menuContentPadding'] ?? [], 'padding', $device ),
416 610 Border::get_css( $attributes['menuContentBorder'] ?? [], '', $device ),
417 611 BoxShadow::get_css( $attributes['boxShadow'], '', $device ),
418 612 );
@@ -420,35 +614,16 @@
420 614
421 615
422 616 public function get_tabs_menu_content_active_css( $attributes, $device = '' ) {
423 617 $tabs_menu_content_active_css = [];
424 - if ( isset( $attributes['tabsMenuPositioning'][ 'value' . $device ] ) ) {
425 - switch ( $attributes['tabsMenuPositioning'][ 'value' . $device ] ) {
426 - case 'top':
427 - $tabs_menu_content_active_css['border-bottom-color'] = 'none';
428 - break;
429 - case 'bottom':
430 - $tabs_menu_content_active_css['border-top-color'] = 'none';
431 - break;
432 - case 'left':
433 - $tabs_menu_content_active_css['border-right-color'] = 'none';
434 - break;
435 - case 'right':
436 - $tabs_menu_content_active_css['border-left-color'] = 'none';
437 - break;
438 - }
439 - }
440 - $border_width = isset( $attributes['menuContentBorder']['commonWidth'] ) && ! empty( $attributes['menuContentBorder']['commonWidth'] )
441 - ? $attributes['menuContentBorder']['commonWidth']
442 - : '2px';
618 +
443 619 if ( isset( $attributes['activeColorOptions'] ) && $attributes['activeColorOptions'] === 'background' ) {
444 620 if ( isset( $attributes['tabActiveBackgroundColor'] ) ) {
445 - $tabs_menu_content_active_css['background-color'] = $attributes['tabActiveBackgroundColor'] . ' !important';
621 + $tabs_menu_content_active_css['background-color'] = Color::get_css( isset( $attributes['tabActiveBackgroundColor'] ) ? $attributes['tabActiveBackgroundColor'] : '' ) . ' !important';
446 622 }
447 623 } elseif ( isset( $attributes['activeColorOptions'] ) && $attributes['activeColorOptions'] === 'border' ) {
448 - $tabs_menu_content_active_css['border-width'] = $border_width;
449 624 if ( isset( $attributes['activeBorderColor'] ) ) {
450 - $tabs_menu_content_active_css['border-color'] = $attributes['activeBorderColor'] . ' !important';
625 + $tabs_menu_content_active_css['border-color'] = Color::get_css( isset( $attributes['activeBorderColor'] ) ? $attributes['activeBorderColor'] : '' ) . ' !important';
451 626 }
452 627 }
453 628
454 629 return $tabs_menu_content_active_css;
@@ -462,23 +637,17 @@
462 637 BoxShadow::get_hover_css( $attributes['boxShadow'], '', $device )
463 638 );
464 639 }
465 640 public function get_tabs_title_css( $attributes, $device = '' ) {
466 - $css = [];
467 - if ( isset( $attributes['titleTextColor'] ) ) {
468 - $css['color'] = $attributes['titleTextColor'];
469 - }
641 + $typographyValueGlobal = ! empty( $attributes['titleTypographyGlobal'] ) ? $attributes['titleTypographyGlobal'] : [];
470 642 return array_merge(
471 - $css,
472 - Typography::get_css( $attributes['titleTypography'] ?? [], '', $device ));
643 + [ 'color' => Color::get_css( isset( $attributes['titleTextColor'] ) ? $attributes['titleTextColor'] : '' ) ],
644 + Typography::get_css( $attributes['titleTypography'] ?? [], '', $device, $typographyValueGlobal ));
473 645 }
474 646
475 647 public function get_tabs_active_title_css( $attributes, $device = '' ) {
476 - $css = [];
477 - if ( isset( $attributes['titleTextActiveColor'] ) ) {
478 - $css['color'] = $attributes['titleTextActiveColor'];
479 - }
480 - return $css;
648 +
649 + return [ 'color' => Color::get_css( isset( $attributes['titleTextActiveColor'] ) ? $attributes['titleTextActiveColor'] : '' ) ];
481 650 }
482 651
483 652 public function get_tabs_subtitle_css( $attributes, $device = '' ) {
484 653 $tabsSubtitleCSS = [];
@@ -484,26 +653,26 @@
484 653 $tabsSubtitleCSS = [];
485 654 if ( isset( $attributes['showActiveSubTitle'] ) && $attributes['showActiveSubTitle'] === true ) {
486 655 $tabsSubtitleCSS['display'] = 'none';
487 656 }
488 - // Get subtitle text color
489 - if ( isset( $attributes['subTitleTextColor'] ) ) {
490 - $tabsSubtitleCSS['color'] = $attributes['subTitleTextColor'];
491 - }
492 -
493 657 // Get typography styles
494 - $typographyStyles = Typography::get_css( $attributes['subTitleTypography'] ?? [], '', $device );
658 + $typographyValueGlobal = ! empty( $attributes['subTitleTypographyGlobal'] ) ? $attributes['subTitleTypographyGlobal'] : [];
659 + $typographyStyles = Typography::get_css( $attributes['subTitleTypography'] ?? [], '', $device, $typographyValueGlobal );
495 660 $tabsSubtitleCSS = array_merge( $tabsSubtitleCSS, $typographyStyles );
496 661
497 662 // Determine width based on menu position
498 - $position = $attributes['tabsMenuPositioning'][ 'value' . $device ] ?? '';
499 - if ( $position === 'top' || $position === 'bottom' ) {
500 - $tabsSubtitleCSS['width'] = '160px';
501 - } else {
663 + $tabsContentWidthType = $this->get_responsive_attribute_value( $attributes['tabsContentWidthType'], $device );
664 + $position = $this->get_responsive_attribute_value( $attributes['tabsMenuPositioning'], $device );
665 + if ( $device === 'Mobile' ) {
502 666 $tabsSubtitleCSS['width'] = '100%';
667 + } elseif ( ( $position === 'top' || $position === 'bottom' ) && $tabsContentWidthType === 'auto' ) {
668 + $tabsSubtitleCSS['max-width'] = '160px';
503 669 }
504 670
505 - return $tabsSubtitleCSS;
671 + return array_merge(
672 + [ 'color' => Color::get_css( isset( $attributes['subTitleTextColor'] ) ? $attributes['subTitleTextColor'] : '' ) ],
673 + $tabsSubtitleCSS
674 + );
506 675 }
507 676
508 677
509 678 public function get_tabs_active_subtitle_text_css( $attributes, $device = '' ) {
@@ -511,9 +680,9 @@
511 680 if ( isset( $attributes['showActiveSubTitle'] ) && $attributes['showActiveSubTitle'] === true ) {
512 681 $css['display'] = 'block';
513 682 }
514 683 if ( isset( $attributes['subTitleTextActiveColor'] ) ) {
515 - $css['color'] = $attributes['subTitleTextActiveColor'] . '!important';
684 + $css['color'] = Color::get_css( isset( $attributes['subTitleTextActiveColor'] ) ? $attributes['subTitleTextActiveColor'] : '' ) . '!important';
516 685 }
517 686 return $css;
518 687 }
519 688 public function get_icon_position_css( $attributes, $device = '' ) {
@@ -521,13 +690,9 @@
521 690 Dimensions::get_css( $attributes['iconPositionMargin'] ?? [], 'margin', $device )
522 691 );
523 692 }
524 693 public function progress_bar_style_css( $attributes, $device = '' ) {
525 - $css = [];
526 - if ( isset( $attributes['progressBarColor'] ) ) {
527 - $css['background-color'] = $attributes['progressBarColor'];
528 - }
529 - return $css;
694 + return [ 'background' => Color::get_css( isset( $attributes['progressBarColor'] ) ? $attributes['progressBarColor'] : '' ) ];
530 695 }
531 696
532 697 public function get_tabs_icon_css( $attributes, $device = '' ) {
533 698 $css = [];
@@ -565,14 +730,8 @@
565 730 if ( $size ) {
566 731 $css['width'] = $size . 'px !important';
567 732 $css['height'] = $size . 'px !important';
568 733 }
569 -
570 - // Apply icon color if available
571 - if ( isset( $attributes['iconColor'] ) ) {
572 - $css['fill'] = $attributes['iconColor'];
573 - }
574 -
575 734 // Apply spacing based on position
576 735 if ( $spacing ) {
577 736 switch ( $iconPosition ) {
578 737 case 'left':
@@ -589,45 +748,33 @@
589 748 break;
590 749 }
591 750 }
592 751 // Merge the icon view CSS with the main CSS
593 - return array_merge( $css, $iconViewCSS );
752 + return array_merge(
753 + [ 'fill' => Color::get_css( isset( $attributes['iconColor'] ) ? $attributes['iconColor'] : '' ) ],
754 + $css,
755 + $iconViewCSS );
594 756 }
595 757
758 + // The active tab's icon follows the title active colour.
596 759 public function get_tabs_active_icon_css( $attributes ) {
597 760 $css = [];
598 -
599 - // Check for active icon color
600 - if ( isset( $attributes['iconActiveColor'] ) ) {
601 - $css['fill'] = $attributes['iconActiveColor'];
761 + if ( ! empty( $attributes['titleTextActiveColor'] ) ) {
762 + $css['fill'] = Color::get_css( $attributes['titleTextActiveColor'] );
602 763 }
603 -
604 - // Check for icon type and active background color
605 - if ( isset( $attributes['iconType'] ) && $attributes['iconType'] !== 'default' && $attributes['iconType'] !== 'framed' ) {
606 - if ( isset( $attributes['iconActiveBackground'] ) ) {
607 - $css['background-color'] = $attributes['iconActiveBackground'];
608 - }
609 - }
610 -
611 764 return $css;
612 765 }
613 766
614 767 public function get_tabs_content_css( $attributes, $device = '' ) {
615 768 $tabs_content_css = [];
616 -
617 769 // Merge margin, padding, and border CSS
618 770 $tabs_content_css = array_merge(
771 + [ 'background' => Color::get_css( isset( $attributes['contentBackgroundColor'] ) ? $attributes['contentBackgroundColor'] : '' ) ],
619 772 $tabs_content_css,
620 773 Dimensions::get_css( $attributes['contentMargin'] ?? [], 'margin', $device ),
621 774 Dimensions::get_css( $attributes['contentPadding'] ?? [], 'padding', $device ),
622 775 Border::get_css( $attributes['contentBorder'] ?? [], '', $device )
623 776 );
624 -
625 - // Apply background color if set
626 - if ( isset( $attributes['contentBackgroundColor'] ) ) {
627 - $tabs_content_css['background-color'] = $attributes['contentBackgroundColor'];
628 - }
629 -
630 777 // Apply max-width based on device and tabsMenuPosition
631 778 if ( $device === 'Mobile' ) {
632 779 $tabs_content_css['max-width'] = '100%';
633 780 } else {
@@ -651,8 +798,11 @@
651 798 }
652 799
653 800 public function get_content_css( $attributes, $device = '' ) {
654 801 $css = [];
802 + if ( isset( $attributes['menuContentAlignment'][ 'value' . $device ] ) ) {
803 + $css['text-align'] = $attributes['menuContentAlignment'][ 'value' . $device ];
804 + }
655 805 return array_merge(
656 806 Range::get_css([
657 807 'attributeValue' => $attributes['contentGap'],
658 808 'attribute_object_key' => 'value',
@@ -668,31 +818,36 @@
668 818 }
669 819 public function get_tabs_width_css( $attributes, $device = '' ) {
670 820 $css = [];
671 821
822 + $tabsWidthType = $this->get_responsive_attribute_value( $attributes['tabsWidthType'], $device );
823 + $tabsMenuPositioning = $this->get_responsive_attribute_value( $attributes['tabsMenuPositioning'], $device );
824 +
672 825 if (
673 - isset( $attributes['tabsMenuPositioning'][ 'value' . $device ] ) &&
674 - (
675 - $attributes['tabsMenuPositioning'][ 'value' . $device ] === 'top' ||
676 - $attributes['tabsMenuPositioning'][ 'value' . $device ] === 'bottom'
677 - )
826 + $tabsMenuPositioning === 'top' ||
827 + $tabsMenuPositioning === 'bottom'
678 828 ) {
679 - $css['max-width'] = '100% !important';
829 + $css['width'] = $tabsWidthType;
830 + return $css;
680 831 }
681 832
682 - return array_merge(
683 - Range::get_css([
684 - 'attributeValue' => $attributes['tabsWidth'],
685 - 'attribute_object_key' => 'value',
686 - 'isResponsive' => true,
687 - 'defaultValue' => 30,
688 - 'hasUnit' => false,
689 - 'unitDefaultValue' => '%',
690 - 'property' => 'max-width',
691 - 'device' => $device,
692 - ]),
693 - $css,
694 - );
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 + }
695 850 }
696 851
697 852 public function get_content_width_css( $attributes, $device = '' ) {
698 853 $css = [];
@@ -718,6 +873,77 @@
718 873 ]),
719 874 $css,
720 875 );
721 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 +
722 948
723 949 }