PluginProbe
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits / 3.1.0
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits v3.1.0
3.2.2 3.2.3 3.2.1 3.2.0 3.1.9 3.1.8 3.1.7 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.9 trunk 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.3 1.1.4 1.1.5 All 174 releases
master-addons / addons / basic / ma-tabs / ma-tabs.php

ma-tabs.php in Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits 3.1.0, at addons/basic/ma-tabs/ma-tabs.php

994 lines 30.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace MasterAddons\Addons;
4
5 use MasterAddons\Inc\Classes\Base\Master_Widget;
6 use \Elementor\Utils;
7 use \Elementor\Controls_Manager;
8 use \Elementor\Repeater;
9 use \Elementor\Group_Control_Border;
10 use \Elementor\Group_Control_Typography;
11 use \Elementor\Group_Control_Box_Shadow;
12 use Elementor\Icons_Manager;
13 use MasterAddons\Inc\Classes\Helper;
14 use MasterAddons\Inc\Admin\Config;
15
16 if (!defined('ABSPATH')) exit; // If this file is called directly, abort.
17
18 class Tabs extends Master_Widget
19 {
20 use \MasterAddons\Inc\Traits\Widget_Notice;
21 use \MasterAddons\Inc\Traits\Widget_Assets_Trait;
22
23 public function get_name()
24 {
25 return 'ma-tabs';
26 }
27
28 public function get_title()
29 {
30 return esc_html__('Advanced Tabs', 'master-addons' );
31 }
32
33 public function get_icon()
34 {
35 return 'jltma-icon ' . Config::get_addon_icon($this->get_name());
36 }
37
38 public function get_keywords()
39 {
40 return [
41 'tab',
42 'hover tabs',
43 'click tabs',
44 'horizontal tab',
45 'vertical tabs',
46 'columns',
47 'tabbed',
48 'panel',
49 'tabular content',
50 'left right',
51 'left right content',
52 'push content'
53 ];
54 }
55
56
57 protected function register_controls()
58 {
59
60 /**
61 * -------------------------------------------
62 * Tab Style MA Tabs Generel Style
63 * -------------------------------------------
64 */
65 $this->start_controls_section(
66 'ma_el_section_tabs_style_preset_settings',
67 [
68 'label' => esc_html__('Presets', 'master-addons' )
69 ]
70 );
71
72 // Define default free options - Pro version overrides via filter
73 $tabs_preset_options = apply_filters('master_addons/addons/tabs/preset', [
74 'two' => esc_html__('Horizontal Tabs', 'master-addons'),
75 'three' => esc_html__('Vertical Tabs', 'master-addons'),
76 'four' => esc_html__('Left Active Border', 'master-addons'),
77 'ma_tabular_pro' => esc_html__('Tabular Content (Pro)', 'master-addons'),
78 ]);
79
80 $this->add_control(
81 'ma_el_tabs_preset',
82 [
83 'label' => esc_html__('Style Preset', 'master-addons'),
84 'type' => Controls_Manager::SELECT,
85 'default' => 'two',
86 'label_block' => false,
87 'options' => $tabs_preset_options,
88 'description' => Helper::upgrade_to_pro('Tabular Content on'),
89 ]
90 );
91
92 $this->add_control(
93 'ma_el_tabs_icon_show',
94 [
95 'label' => esc_html__('Enable Icon', 'master-addons' ),
96 'type' => Controls_Manager::SWITCHER,
97 'default' => 'yes',
98 'return_value' => 'yes',
99 ]
100 );
101
102 // Tabs Pro Layout Controls - filtered through Free_Addons.php
103 $tabs_layout_controls = apply_filters('master_addons/addons/tabs/layout_controls', [
104 [
105 'type' => 'responsive_control',
106 'control_id' => 'ma_el_tabs_left_cols_pro_only',
107 'args' => [
108 'label' => esc_html__('Column Layout (Pro)', 'master-addons'),
109 'type' => Controls_Manager::CHOOSE,
110 'options' => [
111 '1' => [
112 'title' => '',
113 'icon' => 'eicon-lock',
114 ],
115 ],
116 'default' => '1',
117 'description' => Helper::upgrade_to_pro('Column Layout available on'),
118 ],
119 ],
120 [
121 'type' => 'responsive_control',
122 'control_id' => 'ma_el_tabs_icons_style_pro_only',
123 'args' => [
124 'label' => esc_html__('Icon & Tabs Style (Pro)', 'master-addons'),
125 'type' => Controls_Manager::CHOOSE,
126 'options' => [
127 '1' => [
128 'title' => '',
129 'icon' => 'eicon-lock',
130 ],
131 ],
132 'default' => '1',
133 'description' => Helper::upgrade_to_pro('Icon & Tabs Style available on'),
134 ],
135 ],
136 [
137 'type' => 'responsive_control',
138 'control_id' => 'ma_el_tabs_content_style_pro_only',
139 'args' => [
140 'label' => esc_html__('Tabs & Content Style (Pro)', 'master-addons'),
141 'type' => Controls_Manager::CHOOSE,
142 'options' => [
143 '1' => [
144 'title' => '',
145 'icon' => 'eicon-lock',
146 ],
147 ],
148 'default' => '1',
149 'description' => Helper::upgrade_to_pro('Tabs & Content Style available on'),
150 ],
151 ],
152 [
153 'type' => 'control',
154 'control_id' => 'ma_el_tabular_tabs_style_pro_only',
155 'args' => [
156 'label' => esc_html__('Tabs Orientation (Pro)', 'master-addons'),
157 'type' => Controls_Manager::CHOOSE,
158 'options' => [
159 '1' => [
160 'title' => '',
161 'icon' => 'eicon-lock',
162 ],
163 ],
164 'default' => '1',
165 'description' => Helper::upgrade_to_pro('Tabs Orientation available on'),
166 ],
167 ],
168 ]);
169
170 foreach ($tabs_layout_controls as $control) {
171 if ($control['type'] === 'control') {
172 $this->add_control($control['control_id'], $control['args']);
173 } elseif ($control['type'] === 'responsive_control') {
174 $this->add_responsive_control($control['control_id'], $control['args']);
175 }
176 }
177
178 $this->end_controls_section();
179
180 /**
181 * MA Tabs Content Settings
182 */
183 $this->start_controls_section(
184 'ma_el_section_tabs_content_settings',
185 [
186 'label' => esc_html__('Content', 'master-addons' ),
187 'seperator' => 'before',
188 ]
189 );
190
191 $repeater = new Repeater();
192
193 $repeater->add_control(
194 'ma_el_tab_show_as_default',
195 [
196 // 'name' => 'ma_el_tab_show_as_default',
197 'label' => __('Set as Default', 'master-addons' ),
198 'type' => Controls_Manager::SWITCHER,
199 'return_value' => 'active',
200 ]
201 );
202
203 $repeater->add_control(
204 'ma_el_tabs_icon_type',
205 [
206 'label' => esc_html__('Icon Type', 'master-addons' ),
207 'type' => Controls_Manager::CHOOSE,
208 'label_block' => false,
209 'options' => [
210 'none' => [
211 'title' => esc_html__('None', 'master-addons' ),
212 'icon' => 'fa fa-ban',
213 ],
214 'icon' => [
215 'title' => esc_html__('Icon', 'master-addons' ),
216 'icon' => 'eicon-icon-box',
217 ],
218 'image' => [
219 'title' => esc_html__('Image', 'master-addons' ),
220 'icon' => 'eicon-image',
221 ],
222 ],
223 'default' => 'icon',
224 ]
225 );
226
227 $repeater->add_control(
228 'ma_el_tab_title_icon',
229 [
230 'label' => esc_html__('Icon', 'master-addons' ),
231 'description' => esc_html__('Please choose an icon from the list.', 'master-addons' ),
232 'type' => Controls_Manager::ICONS,
233 'default' => [
234 'value' => 'eicon-tabs',
235 'library' => 'elementor',
236 ],
237 'render_type' => 'template',
238 'condition' => [
239 'ma_el_tabs_icon_type' => 'icon'
240 ]
241 ]
242 );
243
244 $repeater->add_control(
245 'ma_el_tab_title_image',
246 [
247 'label' => esc_html__('Image', 'master-addons' ),
248 'type' => Controls_Manager::MEDIA,
249 'default' => [
250 'url' => Utils::get_placeholder_image_src(),
251 ],
252 'condition' => [
253 'ma_el_tabs_icon_type' => 'image'
254 ]
255 ]
256 );
257
258 $repeater->add_control(
259 'ma_el_tab_title',
260 [
261 'label' => esc_html__('Tab Title', 'master-addons' ),
262 'type' => Controls_Manager::TEXT,
263 'default' => esc_html__('Tab Title', 'master-addons' ),
264 'dynamic' => ['active' => true]
265 ]
266 );
267
268 // Define default free options - Pro version overrides via filter
269 $tabs_content_type_options = apply_filters('master_addons/addons/tabs/content_type', [
270 'content' => __('Content', 'master-addons'),
271 'section' => __('Saved Section (Pro)', 'master-addons'),
272 'widget' => __('Saved Widget (Pro)', 'master-addons'),
273 'template' => __('Saved Page Template (Pro)', 'master-addons'),
274 ]);
275
276 $repeater->add_control(
277 'ma_tabs_content_type',
278 [
279 'label' => esc_html__('Content Type', 'master-addons'),
280 'type' => Controls_Manager::SELECT,
281 'label_block' => false,
282 'options' => $tabs_content_type_options,
283 'default' => 'content',
284 'description' => Helper::upgrade_to_pro('3+ more Content Types on'),
285 ]
286 );
287
288 $repeater->add_control(
289 'ma_el_tab_content',
290 [
291 'label' => esc_html__('Tab Content', 'master-addons'),
292 'type' => Controls_Manager::WYSIWYG,
293 'default' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipisicing elit. Optio, neque qui velit. Magni dolorum quidem ipsam eligendi, totam, facilis laudantium cum accusamus ullam voluptatibus commodi numquam, error, est. Ea, consequatur.', 'master-addons'),
294 'condition' => [
295 'ma_tabs_content_type' => 'content',
296 ],
297 ]
298 );
299
300 // Saved Widget options - Pro version overrides via filter
301 $tabs_saved_widget_options = apply_filters('master_addons/addons/tabs/saved_widget', $this->get_page_template_options('widget'));
302
303 $repeater->add_control(
304 'saved_widget',
305 [
306 'label' => __('Choose Widget', 'master-addons'),
307 'type' => Controls_Manager::SELECT,
308 'options' => $tabs_saved_widget_options,
309 'default' => '-1',
310 'condition' => [
311 'ma_tabs_content_type' => 'widget',
312 ],
313 ]
314 );
315
316 // Saved Section options - Pro version overrides via filter
317 $tabs_saved_section_options = apply_filters('master_addons/addons/tabs/saved_section', $this->get_page_template_options('section'));
318
319 $repeater->add_control(
320 'saved_section',
321 [
322 'label' => __('Choose Section', 'master-addons'),
323 'type' => Controls_Manager::SELECT,
324 'options' => $tabs_saved_section_options,
325 'default' => '-1',
326 'condition' => [
327 'ma_tabs_content_type' => 'section',
328 ],
329 ]
330 );
331
332 // Templates options - Pro version overrides via filter
333 $tabs_templates_options = apply_filters('master_addons/addons/tabs/templates', $this->get_page_template_options('page'));
334
335 $repeater->add_control(
336 'templates',
337 [
338 'label' => __('Choose Template', 'master-addons'),
339 'type' => Controls_Manager::SELECT,
340 'options' => $tabs_templates_options,
341 'default' => '-1',
342 'condition' => [
343 'ma_tabs_content_type' => 'template',
344 ],
345 ]
346 );
347
348 $this->add_control(
349 'ma_el_tabs',
350 [
351 'type' => Controls_Manager::REPEATER,
352 'default' => [
353 ['ma_el_tab_title' => esc_html__('Tab Title One', 'master-addons' )],
354 ['ma_el_tab_title' => esc_html__('Tab Title Two', 'master-addons' )],
355 ['ma_el_tab_title' => esc_html__('Tab Title Three', 'master-addons' )],
356 ],
357 'fields' => $repeater->get_controls(),
358 'title_field' => '{{ma_el_tab_title}}',
359 ]
360 );
361
362 $this->add_control(
363 'ma_el_tabs_effect',
364 [
365 'label' => esc_html__('Tab Effect', 'master-addons' ),
366 'type' => Controls_Manager::SELECT,
367 'label_block' => false,
368 'options' => [
369 'hover' => esc_html__('Hover', 'master-addons' ),
370 'click' => esc_html__('Click', 'master-addons' )
371 ],
372 'default' => 'hover',
373 ]
374 );
375
376 $this->end_controls_section();
377
378 /**
379 * -------------------------------------------
380 * Tab Style MA Tabs Heading Style
381 * -------------------------------------------
382 */
383 $this->start_controls_section(
384 'ma_el_section_tabs_heading_style_settings',
385 [
386 'label' => esc_html__('Tabs', 'master-addons' ),
387 'tab' => Controls_Manager::TAB_STYLE,
388 ]
389 );
390 $this->add_group_control(
391 Group_Control_Typography::get_type(),
392 [
393 'name' => 'ma_el_tab_heading_typography',
394 'selector' => '{{WRAPPER}} .jltma--advance-tab .jltma--tab-title',
395 ]
396 );
397
398 $this->add_control(
399 'ma_el_tab_alignment_active',
400 [
401 'label' => esc_html__( 'Alignment', 'master-addons' ),
402 'type' => Controls_Manager::CHOOSE,
403 'options' => [
404 'flex-start' => [
405 'title' => esc_html__( 'Left', 'master-addons' ),
406 'icon' => 'eicon-text-align-left',
407 ],
408 'center' => [
409 'title' => esc_html__( 'Center', 'master-addons' ),
410 'icon' => 'eicon-text-align-center',
411 ],
412 'flex-end' => [
413 'title' => esc_html__( 'Right', 'master-addons' ),
414 'icon' => 'eicon-text-align-right',
415 ],
416 ],
417 'default' => 'flex-start',
418 'toggle' => true,
419 'selectors' => [
420 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li' => 'justify-content: {{VALUE}};'
421 ],
422 'condition' => [
423 'ma_el_tabs_preset!' => 'five',
424 ],
425 ]
426 );
427
428 $this->add_control(
429 'ma_el_tab_gap_active',
430 [
431 'label' => esc_html__( 'Gap', 'master-addons' ),
432 'type' => Controls_Manager::SLIDER,
433 'size_units' => [ 'px', 'em', 'rem' ],
434 'range' => [
435 'px' => [
436 'min' => 0,
437 'max' => 100,
438 'step' => 1,
439 ],
440 'em' => [
441 'min' => 0,
442 'max' => 10,
443 'step' => 0.1,
444 ],
445 'rem' => [
446 'min' => 0,
447 'max' => 10,
448 'step' => 0.1,
449 ],
450 ],
451 'default' => [
452 'size' => 15,
453 'unit' => 'px',
454 ],
455 'selectors' => [
456 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li' => 'gap: {{SIZE}}{{UNIT}};',
457 ],
458 'condition' => [
459 'ma_el_tabs_preset!' => 'five',
460 ],
461 ]
462 );
463
464
465 $this->start_controls_tabs('ma_el_tabs_header_tabs');
466 // Normal State Tab
467 $this->start_controls_tab('ma_el_tabs_header_normal', [
468 'label' => esc_html__(
469 'Normal',
470 'master-addons'
471 )
472 ]);
473
474 $this->add_control(
475 'ma_el_tab_text_color',
476 [
477 'label' => esc_html__('Text Color', 'master-addons' ),
478 'type' => Controls_Manager::COLOR,
479 'default' => '#8a8d91',
480 'selectors' => [
481 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li span, {{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li i' => 'color: {{VALUE}};',
482 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li svg' => 'fill: {{VALUE}};',
483 ],
484 ]
485 );
486
487 $this->add_control(
488 'ma_el_tab_bg_color',
489 [
490 'label' => esc_html__('Background Color', 'master-addons' ),
491 'type' => Controls_Manager::COLOR,
492 'default' => '#FFF',
493 'selectors' => [
494 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li' => 'background: {{VALUE}};'
495 ],
496 ]
497 );
498
499 $this->add_control(
500 'ma_el_tab_border_color',
501 [
502 'label' => esc_html__('Bottom Border Color', 'master-addons' ),
503 'type' => Controls_Manager::COLOR,
504 'default' => '#e5e5e5',
505 'selectors' => [
506 '{{WRAPPER}} .jltma--advance-tab.two .jltma--advance-tab-nav li' => 'border-bottom: 1px solid {{VALUE}};'
507 ],
508 'condition' => [
509 'ma_el_tabs_preset' => 'two'
510 ]
511 ]
512 );
513
514 $this->add_control(
515 'ma_el_tabs_heading_padding',
516 [
517 'label' => esc_html__('Padding', 'master-addons' ),
518 'type' => Controls_Manager::DIMENSIONS,
519 'size_units' => ['px', 'em', '%'],
520 'selectors' => [
521 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
522 ],
523 ]
524 );
525
526 $this->add_control(
527 'ma_el_tabs_heading_margin',
528 [
529 'label' => esc_html__('Margin', 'master-addons' ),
530 'type' => Controls_Manager::DIMENSIONS,
531 'size_units' => ['px', 'em', '%'],
532 'selectors' => [
533 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
534 ],
535 ]
536 );
537
538 $this->add_group_control(
539 Group_Control_Box_Shadow::get_type(),
540 [
541 'name' => 'ma_el_tabs_heading_box_shadow',
542 'selector' => '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li',
543 ]
544 );
545
546 $this->add_control(
547 'ma_el_tabs_icon_size',
548 [
549 'label' => esc_html__('Icon Size (px)', 'master-addons' ),
550 'type' => Controls_Manager::SLIDER,
551 'size_units' => ['px'],
552 'range' => [
553 'px' => [
554 'min' => 0,
555 'max' => 100,
556 ],
557 ],
558 'default' => [
559 'unit' => 'px',
560 'size' => 18,
561 ],
562 'selectors' => array(
563 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li i' => 'font-size:{{SIZE}}{{UNIT}} !important;',
564 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li svg' => 'width:{{SIZE}}{{UNIT}} !important;',
565 ),
566 'style_transfer' => true
567 ]
568 );
569
570 $this->add_group_control(
571 Group_Control_Border::get_type(),
572 [
573 'name' => 'ma_el_tabs_heading_box_border',
574 'separator' => 'before',
575 'selector' => '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li',
576 ]
577 );
578
579 $this->add_control(
580 'ma_el_tabs_heading_border_radius',
581 [
582 'label' => __('Border Radius', 'master-addons' ),
583 'type' => Controls_Manager::DIMENSIONS,
584 'size_units' => ['px', '%', 'em'],
585 'selectors' => [
586 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
587 ]
588 ]
589 );
590 $this->end_controls_tab();
591
592 // Active State Tab
593 $this->start_controls_tab('ma_el_tabs_header_active', [
594 'label' => esc_html__(
595 'Active',
596 'master-addons'
597 )
598 ]);
599 $this->add_control(
600 'ma_el_tab_text_color_active',
601 [
602 'label' => esc_html__('Text Color', 'master-addons' ),
603 'type' => Controls_Manager::COLOR,
604 'default' => '#0a1724',
605 'selectors' => [
606 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li.active span, {{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li.active i' => 'color: {{VALUE}};',
607 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li.active svg' => 'fill: {{VALUE}};'
608 ],
609 ]
610 );
611
612 $this->add_control(
613 'ma_el_tab_bg_color_active',
614 [
615 'label' => esc_html__('Background Color', 'master-addons' ),
616 'type' => Controls_Manager::COLOR,
617 'default' => '#f9f9f9',
618 'selectors' => [
619 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li.active, {{WRAPPER}} .jltma--advance-tab.four .jltma--advance-tab-nav li::before' => 'background: {{VALUE}};',
620 '{{WRAPPER}} .jltma--advance-tab.three .jltma--advance-tab-nav li::before' => 'border-left-color: {{VALUE}};'
621 ],
622 ]
623 );
624
625 $this->add_control(
626 'ma_el_tab_border_color_active',
627 [
628 'label' => esc_html__('Bottom Border Color', 'master-addons' ),
629 'type' => Controls_Manager::COLOR,
630 'default' => '#704aff',
631 'selectors' => [
632 '{{WRAPPER}} .jltma--advance-tab.two .jltma--advance-tab-nav li.active' => 'border-bottom: 1px solid {{VALUE}};',
633 '{{WRAPPER}} .jltma--advance-tab.four .jltma--advance-tab-nav li::after' => 'background: {{VALUE}};'
634 ],
635 'condition' => [
636 'ma_el_tabs_preset' => 'two'
637 ]
638 ]
639 );
640
641 $this->add_control(
642 'ma_el_tab_border_left_color_active',
643 [
644 'label' => esc_html__('Bottom Left Color', 'master-addons' ),
645 'type' => Controls_Manager::COLOR,
646 'default' => '#704aff',
647 'selectors' => [
648 '{{WRAPPER}} .jltma--advance-tab.four .jltma--advance-tab-nav li::after' => 'background: {{VALUE}};'
649 ],
650 'condition' => [
651 'ma_el_tabs_preset' => 'four'
652 ]
653 ]
654 );
655
656 $this->add_control(
657 'ma_el_tabs_heading_active_padding',
658 [
659 'label' => esc_html__('Padding', 'master-addons' ),
660 'type' => Controls_Manager::DIMENSIONS,
661 'size_units' => ['px', 'em', '%'],
662 'selectors' => [
663 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li.active' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
664 ],
665 ]
666 );
667 $this->add_control(
668 'ma_el_tabs_heading_active_margin',
669 [
670 'label' => esc_html__('Margin', 'master-addons' ),
671 'type' => Controls_Manager::DIMENSIONS,
672 'size_units' => ['px', 'em', '%'],
673 'selectors' => [
674 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li.active' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
675 ],
676 ]
677 );
678
679 $this->add_group_control(
680 Group_Control_Box_Shadow::get_type(),
681 [
682 'name' => 'ma_el_tabs_heading_active_box_shadow',
683 'selector' => '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li.active',
684 ]
685 );
686
687 $this->add_group_control(
688 Group_Control_Border::get_type(),
689 [
690 'name' => 'ma_el_tabs_heading_active_box_border',
691 'separator' => 'before',
692 'selector' => '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li.active',
693 ]
694 );
695
696 $this->add_control(
697 'ma_el_tabs_heading_active_border_radius',
698 [
699 'label' => __('Border Radius', 'master-addons' ),
700 'type' => Controls_Manager::DIMENSIONS,
701 'size_units' => ['px', '%', 'em'],
702 'selectors' => [
703 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-nav li.active' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
704 ]
705
706 ]
707 );
708
709 $this->end_controls_tab();
710 $this->end_controls_tabs();
711 $this->end_controls_section();
712
713 /**
714 * -------------------------------------------
715 * Tab Style MA Tabs Content Style
716 * -------------------------------------------
717 */
718 $this->start_controls_section(
719 'ma_el_section_tabs_tab_content_style_settings',
720 [
721 'label' => esc_html__('Content', 'master-addons' ),
722 'tab' => Controls_Manager::TAB_STYLE,
723 ]
724 );
725
726 $this->add_control(
727 'exclusive_tabs_content_title_color',
728 [
729 'label' => esc_html__('Title Color', 'master-addons' ),
730 'type' => Controls_Manager::COLOR,
731 'default' => '#0a1724',
732 'selectors' => [
733 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content .jltma--advance-tab-content-title' =>
734 'color: {{VALUE}};',
735 ],
736 ]
737 );
738 $this->add_group_control(
739 Group_Control_Typography::get_type(),
740 [
741 'name' => 'ma_el_tabs_content_title_typography',
742 'label' => esc_html__('Title Typography', 'master-addons' ),
743 'selector' => '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content-title,
744 {{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content h1,
745 {{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content h2,
746 {{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content h3,
747 {{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content h4,
748 {{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content h5,
749 {{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content h6'
750 ]
751 );
752 $this->add_control(
753 'exclusive_tabs_content_bg_color',
754 [
755 'label' => esc_html__('Background Color', 'master-addons' ),
756 'type' => Controls_Manager::COLOR,
757 'default' => '#f9f9f9',
758 'selectors' => [
759 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content ' => 'background-color: {{VALUE}};',
760 ],
761 ]
762 );
763 $this->add_control(
764 'exclusive_tabs_content_text_color',
765 [
766 'label' => esc_html__('Content Color', 'master-addons' ),
767 'type' => Controls_Manager::COLOR,
768 'default' => '#333',
769 'selectors' => [
770 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content ' => 'color: {{VALUE}};',
771 ],
772 ]
773 );
774 $this->add_group_control(
775 Group_Control_Typography::get_type(),
776 [
777 'name' => 'ma_el_tabs_content_typography',
778 'label' => esc_html__('Content Typography', 'master-addons' ),
779 'selector' => '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content',
780 ]
781 );
782
783 $this->add_control(
784 'jltma_content_alignment',
785 [
786 'label' => esc_html__('Content Alignment', 'master-addons' ),
787 'type' => Controls_Manager::CHOOSE,
788 'default' => 'flex-start',
789 'options' => [
790 'flex-start' => [
791 'title' => esc_html__('Top', 'master-addons' ),
792 'icon' => 'eicon-v-align-top',
793 ],
794 'center' => [
795 'title' => esc_html__('Center', 'master-addons' ),
796 'icon' => 'eicon-v-align-middle',
797 ],
798 'flex-end' => [
799 'title' => esc_html__('Bottom', 'master-addons' ),
800 'icon' => 'eicon-v-align-bottom',
801 ],
802 ],
803 'selectors' => [
804 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content' => 'flex-direction: column; justify-content: {{VALUE}};',
805 ],
806 "condition" => [
807 'ma_el_tabs_preset!' => 'two',
808 ],
809 ]
810 );
811
812 $this->add_responsive_control(
813 'ma_el_tabs_content_border_radius',
814 array(
815 'label' => esc_html__('Border Radius', 'master-addons' ),
816 'type' => Controls_Manager::DIMENSIONS,
817 'size_units' => array('px', '%'),
818 'selectors' => array(
819 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
820 ),
821 )
822 );
823
824 $this->add_group_control(
825 Group_Control_Box_Shadow::get_type(),
826 array(
827 'name' => 'ma_el_tabs_content_box_shadow',
828 'exclude' => array(
829 'box_shadow_position',
830 ),
831 'selector' => '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content',
832 )
833 );
834
835 $this->add_responsive_control(
836 'ma_el_tabs_content_padding',
837 [
838 'label' => esc_html__('Padding', 'master-addons' ),
839 'type' => Controls_Manager::DIMENSIONS,
840 'size_units' => ['px', 'em', '%'],
841 'default' => [
842 'top' => 40,
843 'right' => 40,
844 'bottom' => 40,
845 'left' => 40,
846 'isLinked' => true,
847 ],
848 'selectors' => [
849 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
850 ],
851 ]
852 );
853
854 $this->add_responsive_control(
855 'ma_el_tabs_content_margin',
856 array(
857 'label' => esc_html__('Margin', 'master-addons' ),
858 'type' => Controls_Manager::DIMENSIONS,
859 'size_units' => array('px', '%'),
860 'selectors' => array(
861 '{{WRAPPER}} .jltma--advance-tab .jltma--advance-tab-content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
862 ),
863 )
864 );
865
866 $this->end_controls_section();
867
868 // Help Docs section (links from config.php)
869 $this->jltma_help_docs();
870
871 $this->upgrade_to_pro_message();
872 }
873
874 protected function render()
875 {
876 $settings = $this->get_settings_for_display();
877 $column_order = (isset($settings['ma_el_tabs_left_cols'])) ? 'jltma-row' : '';
878 $this->add_render_attribute(
879 'ma_el_tab_wrapper',
880 [
881 'id' => "jltma--advance-tabs-{$this->get_id()}",
882 'class' => [
883 'jltma--advance-tab',
884 $settings['ma_el_tabs_preset'],
885 $column_order
886 ],
887 'data-tab-effect' => $settings['ma_el_tabs_effect']
888 ]
889 );
890
891 if (isset($settings['ma_el_tabs_left_cols'])) {
892 $ma_el_tabs_left_cols = explode('-', $settings['ma_el_tabs_left_cols']);
893 }
894 $column_order = isset($settings['ma_el_tabs_content_style']) ? $settings['ma_el_tabs_content_style'] : "";
895 ?>
896
897 <div <?php echo $this->get_render_attribute_string('ma_el_tab_wrapper'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Elementor get_render_attribute_string() returns safely escaped HTML attributes ?> data-tabs>
898
899 <?php if (isset($settings['ma_el_tabs_preset']) && $settings['ma_el_tabs_preset'] == "five") { ?>
900 <div class="jltma-col-<?php echo esc_attr($ma_el_tabs_left_cols[0]); ?> <?php
901 if ($column_order == "float-left") {
902 echo "jltma-order-1";
903 } elseif ($settings['ma_el_tabs_left_cols'] == "12-12") {
904 # code...
905 } else {
906 echo "jltma-order-2";
907 } ?>">
908 <?php } ?>
909
910 <ul class="jltma--advance-tab-nav">
911 <?php foreach ($settings['ma_el_tabs'] as $key => $tab) { ?>
912 <li class="<?php echo esc_attr($tab['ma_el_tab_show_as_default']); ?>" data-tab data-tab-id="jltma-tab-<?php echo esc_attr($this->get_id() . $key); ?>">
913 <?php if ($settings['ma_el_tabs_icon_show'] === 'yes') {
914 if ($tab['ma_el_tabs_icon_type'] === 'icon') {
915 $migrated = isset($tab['__fa4_migrated']['ma_el_tab_title_icon']);
916 $is_new = empty($tab['icon']) && Icons_Manager::is_migration_allowed();
917 if ($is_new || $migrated){
918 Icons_Manager::render_icon($tab['ma_el_tab_title_icon'], ['aria-hidden' => 'true']);
919 } else { ?>
920 <i class="<?php echo esc_attr($tab['icon']); ?>" aria-hidden="true"></i>
921 <?php } ?>
922 <?php } elseif ($tab['ma_el_tabs_icon_type'] === 'image') { ?>
923 <img src="<?php echo esc_attr($tab['ma_el_tab_title_image']['url']);
924 ?>">
925 <?php
926 }
927 } ?>
928 <span class="jltma--tab-title">
929 <?php echo $this->parse_text_editor($tab['ma_el_tab_title']); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Elementor parse_text_editor() returns sanitized HTML ?>
930 </span>
931 </li>
932 <?php } ?>
933 </ul>
934
935 <?php if ($settings['ma_el_tabs_preset'] == "five") { ?>
936 </div>
937
938 <div class="jltma-col-<?php echo esc_attr($ma_el_tabs_left_cols[1]); ?> <?php if ($column_order == "float-left") {
939 echo "jltma-order-2";
940 } else {
941 echo "jltma-order-1";
942 } ?>">
943 <?php } ?>
944
945 <div class="tab-content">
946 <?php foreach ($settings['ma_el_tabs'] as $key => $tab) : $ma_el_find_default_tab[] = $tab['ma_el_tab_show_as_default']; ?>
947 <div id="jltma-tab-<?php echo esc_attr($this->get_id() . $key); ?>" class="jltma--advance-tab-content tab-pane <?php echo esc_attr(
948 $tab['ma_el_tab_show_as_default']
949 ); ?>">
950 <?php
951 // Content type rendering - Pro content types filtered through Free_Addons.php
952 $pro_content_types = apply_filters('master_addons/addons/tabs/content_types', ['content']);
953
954 if ($tab['ma_tabs_content_type'] == 'content') {
955 echo do_shortcode($tab['ma_el_tab_content']);
956 } else if (in_array('section', $pro_content_types) && $tab['ma_tabs_content_type'] == 'section' && !empty($tab['saved_section'])) {
957 echo \Elementor\Plugin::$instance->frontend->get_builder_content_for_display($tab['saved_section']); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Elementor get_builder_content_for_display() returns sanitized frontend markup
958 } else if (in_array('template', $pro_content_types) && $tab['ma_tabs_content_type'] == 'template' && !empty($tab['templates'])) {
959 echo \Elementor\Plugin::$instance->frontend->get_builder_content_for_display($tab['templates']); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Elementor get_builder_content_for_display() returns sanitized frontend markup
960 } else if (in_array('widget', $pro_content_types) && $tab['ma_tabs_content_type'] == 'widget' && !empty($tab['saved_widget'])) {
961 echo \Elementor\Plugin::$instance->frontend->get_builder_content_for_display($tab['saved_widget']); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Elementor get_builder_content_for_display() returns sanitized frontend markup
962 }
963 ?>
964 </div><!-- jltma--advance-tab-content -->
965 <?php endforeach; ?>
966 </div> <!-- tab-content -->
967
968 <?php if ($settings['ma_el_tabs_preset'] == "five") { ?>
969 </div> <!-- col-5 -->
970 <?php } ?>
971
972 </div>
973 <?php
974 }
975
976 public function get_page_template_options($type = '')
977 {
978
979 $page_templates = Helper::ma_get_page_templates($type);
980
981 $options[-1] = esc_html__('Select', 'master-addons' );
982
983 if (count($page_templates)) {
984 foreach ($page_templates as $id => $name) {
985 $options[$id] = $name;
986 }
987 } else {
988 $options['no_template'] = esc_html__('No saved templates found!', 'master-addons' );
989 }
990
991 return $options;
992 }
993 }
994