templates
4 months ago
Accordion.php
9 months ago
Alerts_Box.php
9 months ago
Blog_Grid.php
6 months ago
Cheat_Sheet.php
6 months ago
Counter.php
6 months ago
Dynamic_Faq.php
1 month ago
Icon_Box.php
6 months ago
Integrations.php
6 months ago
List_Item.php
9 months ago
Tabs.php
6 months ago
Team_Carousel.php
6 months ago
Testimonial.php
6 months ago
Timeline.php
9 months ago
Video_Playlist.php
6 months ago
Video_Popup.php
6 months ago
Tabs.php
840 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Use namespace to avoid conflict |
| 4 | */ |
| 5 | |
| 6 | namespace SPEL\Widgets; |
| 7 | |
| 8 | use Elementor\Group_Control_Background; |
| 9 | use Elementor\Group_Control_Border; |
| 10 | use Elementor\Group_Control_Typography; |
| 11 | use Elementor\Widget_Base; |
| 12 | use Elementor\Controls_Manager; |
| 13 | use Elementor\Repeater; |
| 14 | |
| 15 | // Exit if accessed directly |
| 16 | if ( ! defined( 'ABSPATH' ) ) { |
| 17 | exit; |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Class Tabs |
| 22 | * @package spider\Widgets |
| 23 | * @since 1.0.0 |
| 24 | */ |
| 25 | class Tabs extends Widget_Base { |
| 26 | |
| 27 | public function get_name(): string |
| 28 | { |
| 29 | return 'docy_tabs'; // ID of the widget (Don't change this name) |
| 30 | } |
| 31 | |
| 32 | public function get_title(): string |
| 33 | { |
| 34 | return esc_html__( 'Tabs', 'spider-elements' ); |
| 35 | } |
| 36 | |
| 37 | public function get_icon(): string |
| 38 | { |
| 39 | return 'eicon-tabs spel-icon'; |
| 40 | } |
| 41 | |
| 42 | public function get_keywords(): array |
| 43 | { |
| 44 | return [ 'spider', 'spider elements', 'tab', 'tabs', 'tab widget' ]; |
| 45 | } |
| 46 | |
| 47 | public function get_categories(): array |
| 48 | { |
| 49 | return [ 'spider-elements' ]; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Name: get_style_depends() |
| 54 | * Desc: Register the required CSS dependencies for the frontend. |
| 55 | */ |
| 56 | public function get_style_depends(): array |
| 57 | { |
| 58 | return [ 'elegant-icon', 'spel-main' ]; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Name: get_script_depends() |
| 63 | * Desc: Register the required JS dependencies for the frontend. |
| 64 | */ |
| 65 | public function get_script_depends(): array |
| 66 | { |
| 67 | return [ 'spel-el-widgets' ]; |
| 68 | } |
| 69 | |
| 70 | |
| 71 | /** |
| 72 | * Name: register_controls() |
| 73 | * Desc: Register controls for these widgets |
| 74 | * Params: no params |
| 75 | * Return: @void |
| 76 | * Since: @1.0.0 |
| 77 | * Package: @spider-elements |
| 78 | * Author: spider-themes |
| 79 | */ |
| 80 | protected function register_controls(): void |
| 81 | { |
| 82 | $this->elementor_content_control(); |
| 83 | $this->elementor_style_control(); |
| 84 | } |
| 85 | |
| 86 | |
| 87 | /** |
| 88 | * Name: elementor_content_control() |
| 89 | * Desc: Register the Content Tab output on the Elementor editor. |
| 90 | * Params: no params |
| 91 | * Return: @void |
| 92 | * Since: @1.0.0 |
| 93 | * Package: @spider-elements |
| 94 | * Author: spider-themes |
| 95 | */ |
| 96 | public function elementor_content_control(): void |
| 97 | { |
| 98 | |
| 99 | // ============================ Select Style ===========================// |
| 100 | $this->start_controls_section( |
| 101 | 'select_style', |
| 102 | [ |
| 103 | 'label' => esc_html__( 'Preset Skins', 'spider-elements' ), |
| 104 | ] |
| 105 | ); |
| 106 | |
| 107 | $this->add_control( |
| 108 | 'style', |
| 109 | [ |
| 110 | 'label' => esc_html__( 'Style', 'spider-elements' ), |
| 111 | 'type' => Controls_Manager::SELECT, |
| 112 | 'options' => [ |
| 113 | '1' => esc_html__( 'Inline Tab', 'spider-elements' ), |
| 114 | '2' => esc_html__( 'Full-width Tab', 'spider-elements' ), |
| 115 | ], |
| 116 | 'default' => '1', |
| 117 | ] |
| 118 | ); |
| 119 | |
| 120 | $this->end_controls_section(); // End Select Style |
| 121 | |
| 122 | |
| 123 | // ============================ Tabs ===========================// |
| 124 | $this->start_controls_section( |
| 125 | 'sec_tabs', |
| 126 | [ |
| 127 | 'label' => esc_html__( 'Tabs', 'spider-elements' ), |
| 128 | ] |
| 129 | ); |
| 130 | |
| 131 | $repeater = new Repeater(); |
| 132 | $repeater->add_control( |
| 133 | 'icon', |
| 134 | [ |
| 135 | 'label' => esc_html__( 'Icon', 'spider-elements' ), |
| 136 | 'type' => Controls_Manager::ICONS, |
| 137 | ] |
| 138 | ); |
| 139 | |
| 140 | $repeater->add_control( |
| 141 | 'tab_title', |
| 142 | [ |
| 143 | 'label' => esc_html__( 'Tab Title', 'spider-elements' ), |
| 144 | 'type' => Controls_Manager::TEXT, |
| 145 | 'default' => esc_html__( 'Tab Title', 'spider-elements' ), |
| 146 | 'placeholder' => esc_html__( 'Tab Title', 'spider-elements' ), |
| 147 | 'label_block' => true, |
| 148 | ] |
| 149 | ); |
| 150 | |
| 151 | $repeater->add_control( |
| 152 | 'tabs_content_type', |
| 153 | [ |
| 154 | 'label' => esc_html__( 'Content Type', 'spider-elements' ), |
| 155 | 'type' => Controls_Manager::SELECT, |
| 156 | 'options' => [ |
| 157 | 'content' => esc_html__( 'Content', 'spider-elements' ), |
| 158 | 'template' => esc_html__( 'Saved Templates', 'spider-elements' ), |
| 159 | ], |
| 160 | 'default' => 'content', |
| 161 | ] |
| 162 | ); |
| 163 | |
| 164 | $repeater->add_control( |
| 165 | 'primary_templates', |
| 166 | [ |
| 167 | 'label' => esc_html__( 'Choose Template', 'spider-elements' ), |
| 168 | 'type' => Controls_Manager::SELECT, |
| 169 | 'options' => spel_get_el_templates(), |
| 170 | 'condition' => [ |
| 171 | 'tabs_content_type' => 'template', |
| 172 | ], |
| 173 | ] |
| 174 | ); |
| 175 | |
| 176 | $repeater->add_control( |
| 177 | 'tab_content', |
| 178 | [ |
| 179 | 'label' => esc_html__( 'Content', 'spider-elements' ), |
| 180 | 'default' => esc_html__( 'Tab Content', 'spider-elements' ), |
| 181 | 'placeholder' => esc_html__( 'Tab Content', 'spider-elements' ), |
| 182 | 'type' => Controls_Manager::WYSIWYG, |
| 183 | 'show_label' => false, |
| 184 | 'condition' => [ |
| 185 | 'tabs_content_type' => 'content', |
| 186 | ], |
| 187 | ] |
| 188 | ); |
| 189 | |
| 190 | $repeater->end_controls_tab(); // End tab |
| 191 | |
| 192 | $this->add_control( |
| 193 | 'tabs', |
| 194 | [ |
| 195 | 'label' => esc_html__( 'Add Items', 'spider-elements' ), |
| 196 | 'type' => Controls_Manager::REPEATER, |
| 197 | 'fields' => $repeater->get_controls(), |
| 198 | 'title_field' => '{{{ tab_title }}}', |
| 199 | 'default' => [ |
| 200 | [ |
| 201 | 'tab_title' => esc_html__( 'Tab Title #1', 'spider-elements' ), |
| 202 | 'tab_content' => esc_html__( 'Nostra adipiscing sequi nisi hic venenatis pede aliquid eget aperiam commodi gravida?', 'spider-elements' ), |
| 203 | ], |
| 204 | [ |
| 205 | 'tab_title' => esc_html__( 'Tab Title #2', 'spider-elements' ), |
| 206 | 'tab_content' => esc_html__( 'Nostra adipiscing sequi nisi hic venenatis pede aliquid eget aperiam commodi gravida?', 'spider-elements' ), |
| 207 | ], |
| 208 | [ |
| 209 | 'tab_title' => esc_html__( 'Tab Title #3', 'spider-elements' ), |
| 210 | 'tab_content' => esc_html__( 'Nostra adipiscing sequi nisi hic venenatis pede aliquid eget aperiam commodi gravida?', 'spider-elements' ), |
| 211 | ], |
| 212 | ], |
| 213 | ] |
| 214 | ); |
| 215 | |
| 216 | $this->add_control( |
| 217 | 'is_navigation_arrow', |
| 218 | [ |
| 219 | 'label' => esc_html__( 'Navigation Arrow', 'spider-elements' ), |
| 220 | 'type' => Controls_Manager::SWITCHER, |
| 221 | 'description' => esc_html__( 'Show/Hide navigation arrow button for content area', 'spider-elements' ), |
| 222 | 'label_on' => esc_html__( 'Show', 'spider-elements' ), |
| 223 | 'label_off' => esc_html__( 'Hide', 'spider-elements' ), |
| 224 | 'return_value' => 'yes', |
| 225 | 'default' => 'no', |
| 226 | 'separator' => 'before' |
| 227 | ] |
| 228 | ); |
| 229 | |
| 230 | $this->add_control( |
| 231 | 'is_auto_numb', [ |
| 232 | 'label' => esc_html__( 'Auto Numbering', 'spider-elements' ), |
| 233 | 'type' => Controls_Manager::SWITCHER, |
| 234 | 'description' => esc_html__( 'Show/Hide auto numbering for tab title', 'spider-elements' ), |
| 235 | 'label_on' => esc_html__( 'Show', 'spider-elements' ), |
| 236 | 'label_off' => esc_html__( 'Hide', 'spider-elements' ), |
| 237 | 'return_value' => 'yes', |
| 238 | 'default' => 'no', |
| 239 | 'separator' => 'before' |
| 240 | ] |
| 241 | ); |
| 242 | |
| 243 | $this->add_control( |
| 244 | 'is_auto_play', |
| 245 | [ |
| 246 | 'label' => esc_html__( 'Auto Play', 'spider-elements' ), |
| 247 | 'type' => Controls_Manager::SWITCHER, |
| 248 | 'description' => esc_html__( 'Show/Hide auto play for tab', 'spider-elements' ), |
| 249 | 'label_on' => esc_html__( 'Show', 'spider-elements' ), |
| 250 | 'label_off' => esc_html__( 'Hide', 'spider-elements' ), |
| 251 | 'return_value' => 'yes', |
| 252 | 'default' => 'no', |
| 253 | 'separator' => 'before' |
| 254 | ] |
| 255 | ); |
| 256 | |
| 257 | $this->add_control( |
| 258 | 'is_sticky_tab', |
| 259 | [ |
| 260 | 'label' => esc_html__( 'Sticky Mode', 'spider-elements' ), |
| 261 | 'type' => Controls_Manager::SWITCHER, |
| 262 | 'description' => esc_html__( 'Show/Hide sticky mode for tab title', 'spider-elements' ), |
| 263 | 'label_on' => esc_html__( 'Show', 'spider-elements' ), |
| 264 | 'label_off' => esc_html__( 'Hide', 'spider-elements' ), |
| 265 | 'return_value' => 'yes', |
| 266 | 'default' => 'no', |
| 267 | 'separator' => 'before' |
| 268 | ] |
| 269 | ); |
| 270 | |
| 271 | $this->add_control( |
| 272 | 'tab_alignment', |
| 273 | [ |
| 274 | 'label' => esc_html__( 'Alignment', 'spider-elements' ), |
| 275 | 'type' => Controls_Manager::CHOOSE, |
| 276 | 'options' => [ |
| 277 | 'flex-start' => [ |
| 278 | 'title' => esc_html__( 'Left', 'spider-elements' ), |
| 279 | 'icon' => 'eicon-h-align-left', |
| 280 | ], |
| 281 | 'center' => [ |
| 282 | 'title' => esc_html__( 'Center', 'spider-elements' ), |
| 283 | 'icon' => ' eicon-h-align-center', |
| 284 | ], |
| 285 | 'flex-end' => [ |
| 286 | 'title' => esc_html__( 'Right', 'spider-elements' ), |
| 287 | 'icon' => 'eicon-h-align-right', |
| 288 | ], |
| 289 | ], |
| 290 | 'default' => 'flex-start', |
| 291 | 'toggle' => true, |
| 292 | 'selectors' => [ |
| 293 | '{{WRAPPER}} .tab_shortcode .nav-tabs' => 'justify-content: {{VALUE}};', |
| 294 | '{{WRAPPER}} .header_tabs_area .nav-tabs' => 'justify-content: {{VALUE}};', |
| 295 | ], |
| 296 | 'separator' => 'before' |
| 297 | ] |
| 298 | ); |
| 299 | |
| 300 | $this->end_controls_section(); // End Tabs Section |
| 301 | |
| 302 | } |
| 303 | |
| 304 | |
| 305 | /** |
| 306 | * Name: elementor_style_control() |
| 307 | * Desc: Register the Style Tab output on the Elementor editor. |
| 308 | * Params: no params |
| 309 | * Return: @void |
| 310 | * Since: @1.0.0 |
| 311 | * Package: @spider-elements |
| 312 | * Author: spider-themes |
| 313 | */ |
| 314 | public function elementor_style_control(): void |
| 315 | { |
| 316 | |
| 317 | //============================ Tab Title Style ============================// |
| 318 | $this->start_controls_section( |
| 319 | 'style_tabs_sec', [ |
| 320 | 'label' => esc_html__( 'Tab Title', 'spider-elements' ), |
| 321 | 'tab' => Controls_Manager::TAB_STYLE, |
| 322 | ] |
| 323 | ); |
| 324 | |
| 325 | $this->add_group_control( |
| 326 | Group_Control_Typography::get_type(), [ |
| 327 | 'name' => 'tab_item_typo', |
| 328 | 'selector' => '{{WRAPPER}} .nav-tabs .nav-item .nav-link', |
| 329 | ] |
| 330 | ); |
| 331 | |
| 332 | $this->add_responsive_control( |
| 333 | 'icon_size', [ |
| 334 | 'label' => esc_html__( 'Icon Size', 'spider-elements' ), |
| 335 | 'type' => Controls_Manager::SLIDER, |
| 336 | 'size_units' => [ 'px', '%' ], |
| 337 | 'range' => [ |
| 338 | 'px' => [ |
| 339 | 'min' => 0, |
| 340 | 'max' => 100, |
| 341 | 'step' => 1, |
| 342 | ], |
| 343 | '%' => [ |
| 344 | 'min' => 0, |
| 345 | 'max' => 100, |
| 346 | ], |
| 347 | ], |
| 348 | 'default' => [ |
| 349 | 'unit' => 'px', |
| 350 | ], |
| 351 | 'selectors' => [ |
| 352 | '{{WRAPPER}} .nav-tabs .nav-item .nav-link i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 353 | ], |
| 354 | ] |
| 355 | ); |
| 356 | |
| 357 | $this->add_control( |
| 358 | 'flex_column_gap', [ |
| 359 | 'label' => esc_html__( 'Gap Between Tab', 'spider-elements' ), |
| 360 | 'type' => \Elementor\Controls_Manager::SLIDER, |
| 361 | 'size_units' => ['px', '%', 'em'], |
| 362 | 'range' => [ |
| 363 | 'px' => [ |
| 364 | 'min' => 0, |
| 365 | 'max' => 100, |
| 366 | 'step' => 1, |
| 367 | ], |
| 368 | '%' => [ |
| 369 | 'min' => 0, |
| 370 | 'max' => 100, |
| 371 | ], |
| 372 | 'em' => [ |
| 373 | 'min' => 0, |
| 374 | 'max' => 10, |
| 375 | 'step' => 0.1, |
| 376 | ], |
| 377 | ], |
| 378 | 'selectors' => [ |
| 379 | '{{WRAPPER}} .sticky_tab_item .nav-tabs' => 'gap: {{SIZE}}{{UNIT}};', |
| 380 | ], |
| 381 | ] |
| 382 | ); |
| 383 | |
| 384 | $this->add_group_control( |
| 385 | \Elementor\Group_Control_Border::get_type(), [ |
| 386 | 'name' => 'title_border', |
| 387 | 'selector' => '{{WRAPPER}} .nav-tabs .nav-item .nav-link', |
| 388 | ] |
| 389 | ); |
| 390 | |
| 391 | $this->add_responsive_control( |
| 392 | 'title_border_radius', |
| 393 | [ |
| 394 | 'label' => esc_html__( 'Border Radius', 'spider-elements' ), |
| 395 | 'type' => Controls_Manager::DIMENSIONS, |
| 396 | 'size_units' => [ 'px', '%', 'em' ], |
| 397 | 'selectors' => [ |
| 398 | '{{WRAPPER}} .nav-tabs .nav-item .nav-link' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 399 | ], |
| 400 | ] |
| 401 | ); |
| 402 | |
| 403 | $this->add_responsive_control( |
| 404 | 'tab_pad', [ |
| 405 | 'label' => esc_html__( 'Padding', 'spider-elements' ), |
| 406 | 'type' => Controls_Manager::DIMENSIONS, |
| 407 | 'size_units' => [ 'px', '%', 'em' ], |
| 408 | 'selectors' => [ |
| 409 | '{{WRAPPER}} .nav-tabs .nav-item .nav-link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 410 | ], |
| 411 | ] |
| 412 | ); |
| 413 | |
| 414 | $this->add_control( |
| 415 | 'tab_title_hr', [ |
| 416 | 'type' => Controls_Manager::DIVIDER, |
| 417 | ] |
| 418 | ); |
| 419 | |
| 420 | // Tab Title Normal/Active/hover State |
| 421 | $this->start_controls_tabs( |
| 422 | 'style_tab_title_tabs' |
| 423 | ); |
| 424 | |
| 425 | //=== Normal Tab Title |
| 426 | $this->start_controls_tab( |
| 427 | 'style_tab_title_normal', |
| 428 | [ |
| 429 | 'label' => esc_html__( 'Normal', 'spider-elements' ), |
| 430 | ] |
| 431 | ); |
| 432 | |
| 433 | $this->add_control( |
| 434 | 'normal_tab_title_text_color', |
| 435 | [ |
| 436 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 437 | 'type' => Controls_Manager::COLOR, |
| 438 | 'selectors' => array( |
| 439 | '{{WRAPPER}} .nav-tabs .nav-item .nav-link' => 'color: {{VALUE}}', |
| 440 | ) |
| 441 | ] |
| 442 | ); |
| 443 | |
| 444 | $this->add_group_control( |
| 445 | \Elementor\Group_Control_Background::get_type(), |
| 446 | [ |
| 447 | 'name' => 'normal_tab_title_bg_color', |
| 448 | 'types' => [ 'classic', 'gradient' ], |
| 449 | 'exclude' => [ 'image' ], |
| 450 | 'selector' => '{{WRAPPER}} .nav-tabs .nav-item .nav-link', |
| 451 | ] |
| 452 | ); |
| 453 | |
| 454 | $this->end_controls_tab(); //End Normal Tab Title |
| 455 | |
| 456 | //=== Hover Tab Title |
| 457 | $this->start_controls_tab( |
| 458 | 'style_tab_title_hover', [ |
| 459 | 'label' => esc_html__( 'Hover', 'spider-elements' ), |
| 460 | ] |
| 461 | ); |
| 462 | |
| 463 | $this->add_control( |
| 464 | 'hover_tab_title_text_color', [ |
| 465 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 466 | 'type' => Controls_Manager::COLOR, |
| 467 | 'selectors' => array( |
| 468 | '{{WRAPPER}} .nav-tabs .nav-item .nav-link:hover' => 'color: {{VALUE}};', |
| 469 | ) |
| 470 | ] |
| 471 | ); |
| 472 | |
| 473 | $this->add_group_control( |
| 474 | \Elementor\Group_Control_Background::get_type(), |
| 475 | [ |
| 476 | 'name' => 'hover_tab_title_bg_color', |
| 477 | 'types' => [ 'classic', 'gradient' ], |
| 478 | 'exclude' => [ 'image' ], |
| 479 | 'selector' => '{{WRAPPER}} .nav-tabs .nav-item .nav-link:hover', |
| 480 | ] |
| 481 | ); |
| 482 | |
| 483 | $this->end_controls_tab(); //End Hover Tab Title |
| 484 | |
| 485 | //=== Active Tab Title |
| 486 | $this->start_controls_tab( |
| 487 | 'style_tab_title_active', [ |
| 488 | 'label' => esc_html__( 'Active', 'spider-elements' ), |
| 489 | ] |
| 490 | ); |
| 491 | |
| 492 | $this->add_control( |
| 493 | 'active_tab_title_text_color', [ |
| 494 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 495 | 'type' => Controls_Manager::COLOR, |
| 496 | 'selectors' => array( |
| 497 | '{{WRAPPER}} .nav-tabs .nav-item .nav-link.active' => 'color: {{VALUE}};', |
| 498 | ) |
| 499 | ] |
| 500 | ); |
| 501 | |
| 502 | $this->add_group_control( |
| 503 | \Elementor\Group_Control_Background::get_type(), [ |
| 504 | 'name' => 'active_tab_title_bg_color', |
| 505 | 'types' => [ 'classic', 'gradient' ], |
| 506 | 'exclude' => [ 'image' ], |
| 507 | 'selector' => '{{WRAPPER}} .nav-tabs .nav-item .nav-link.active' |
| 508 | ] |
| 509 | ); |
| 510 | |
| 511 | $this->add_control( |
| 512 | 'active_tab_title_border_color', [ |
| 513 | 'label' => esc_html__( 'Top Border', 'spider-elements' ), |
| 514 | 'type' => Controls_Manager::COLOR, |
| 515 | 'selectors' => array( |
| 516 | '{{WRAPPER}} .nav-tabs .nav-item .nav-link:before' => 'background: {{VALUE}};', |
| 517 | ), |
| 518 | ] |
| 519 | ); |
| 520 | |
| 521 | $this->end_controls_tab(); // End Active Tab Title |
| 522 | $this->end_controls_tabs(); |
| 523 | |
| 524 | $this->end_controls_section(); // End Tab Title Style |
| 525 | |
| 526 | |
| 527 | //============================ Style Auto Numbering ============================// |
| 528 | $this->start_controls_section( |
| 529 | 'style_auto_num', [ |
| 530 | 'label' => esc_html__( 'Tab Auto Number', 'spider-elements' ), |
| 531 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 532 | 'condition' => [ |
| 533 | 'is_auto_numb' => 'yes' |
| 534 | ] |
| 535 | ] |
| 536 | ); |
| 537 | |
| 538 | $this->start_controls_tabs( |
| 539 | 'auto_num_style_tabs' |
| 540 | ); |
| 541 | |
| 542 | //===== Normal Tab |
| 543 | $this->start_controls_tab( |
| 544 | 'style_tab_normal_auto_num', [ |
| 545 | 'label' => esc_html__( 'Normal', 'spider-elements' ), |
| 546 | ] |
| 547 | ); |
| 548 | |
| 549 | $this->add_control( |
| 550 | 'normal_tab_title_auto_num_color', [ |
| 551 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 552 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 553 | 'selectors' => [ |
| 554 | '{{WRAPPER}} .nav-tabs .nav-item .nav-link .numb' => 'color: {{VALUE}}', |
| 555 | ], |
| 556 | ] |
| 557 | ); |
| 558 | |
| 559 | $this->add_control( |
| 560 | 'normal_tab_title_auto_num_bg_color', [ |
| 561 | 'label' => esc_html__( 'Background Color', 'spider-elements' ), |
| 562 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 563 | 'selectors' => [ |
| 564 | '{{WRAPPER}} .nav-tabs .nav-item .nav-link .numb' => 'background: {{VALUE}}', |
| 565 | ], |
| 566 | ] |
| 567 | ); |
| 568 | |
| 569 | $this->end_controls_tab(); //End Normal Tab |
| 570 | |
| 571 | //===== Hover Tab |
| 572 | $this->start_controls_tab( |
| 573 | 'style_tab_active_auto_num', |
| 574 | [ |
| 575 | 'label' => esc_html__( 'Active', 'spider-elements' ), |
| 576 | ] |
| 577 | ); |
| 578 | |
| 579 | $this->add_control( |
| 580 | 'active_tab_title_auto_num_color', [ |
| 581 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 582 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 583 | 'selectors' => [ |
| 584 | '{{WRAPPER}} .nav-tabs .nav-item .nav-link.active .numb' => 'color: {{VALUE}}', |
| 585 | ], |
| 586 | ] |
| 587 | ); |
| 588 | |
| 589 | $this->add_control( |
| 590 | 'active_tab_title_auto_num_bg_color', [ |
| 591 | 'label' => esc_html__( 'Background Color', 'spider-elements' ), |
| 592 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 593 | 'selectors' => [ |
| 594 | '{{WRAPPER}} .nav-tabs .nav-item .nav-link.active .numb' => 'background: {{VALUE}}', |
| 595 | ], |
| 596 | ] |
| 597 | ); |
| 598 | |
| 599 | $this->end_controls_tab(); // End Hover Tab |
| 600 | |
| 601 | $this->end_controls_tabs(); // End Style Tabs |
| 602 | |
| 603 | $this->end_controls_section(); //End Auto Numbering |
| 604 | |
| 605 | |
| 606 | //============================ Tab ProgressBar Style ============================// |
| 607 | $this->start_controls_section( |
| 608 | 'style_tabs_progressbar', |
| 609 | [ |
| 610 | 'label' => esc_html__( 'Tab ProgressBar', 'spider-elements' ), |
| 611 | 'tab' => Controls_Manager::TAB_STYLE, |
| 612 | 'condition' => [ |
| 613 | 'is_auto_play' => 'yes', |
| 614 | ] |
| 615 | ] |
| 616 | ); |
| 617 | |
| 618 | $this->add_group_control( |
| 619 | \Elementor\Group_Control_Background::get_type(), |
| 620 | [ |
| 621 | 'name' => 'progressbar_bg_color', |
| 622 | 'types' => [ 'classic', 'gradient' ], |
| 623 | 'exclude' => [ 'image' ], |
| 624 | 'selector' => |
| 625 | '{{WRAPPER}} .tab_auto_play .nav-item .nav-link .progress-bar,{{WRAPPER}} .tab_auto_play .nav-item .nav-link.active .tab_progress:before', |
| 626 | |
| 627 | ] |
| 628 | ); |
| 629 | $this->add_responsive_control( |
| 630 | 'progressbar_height', [ |
| 631 | 'label' => esc_html__( 'Progress Bar Hegiht', 'spider-elements' ), |
| 632 | 'type' => Controls_Manager::SLIDER, |
| 633 | 'size_units' => [ 'px', '%' ], |
| 634 | 'range' => [ |
| 635 | 'px' => [ |
| 636 | 'min' => 0, |
| 637 | 'max' => 10, |
| 638 | ], |
| 639 | '%' => [ |
| 640 | 'min' => 0, |
| 641 | 'max' => 10, |
| 642 | ], |
| 643 | ], |
| 644 | 'default' => [ |
| 645 | 'unit' => 'px', |
| 646 | 'size' => '2', |
| 647 | ], |
| 648 | 'selectors' => [ |
| 649 | '{{WRAPPER}} .tab_auto_play .nav-item .nav-link .progress-bar,{{WRAPPER}} .tab_auto_play .nav-item .nav-link .tab_progress' => 'height: {{SIZE}}{{UNIT}};', |
| 650 | ], |
| 651 | ] |
| 652 | ); |
| 653 | |
| 654 | $this->end_controls_section(); |
| 655 | |
| 656 | |
| 657 | //=============================== Content Section ===============================// |
| 658 | $this->start_controls_section( |
| 659 | 'style_content', [ |
| 660 | 'label' => esc_html__( 'Contents', 'spider-elements' ), |
| 661 | 'tab' => Controls_Manager::TAB_STYLE, |
| 662 | ] |
| 663 | ); |
| 664 | |
| 665 | $this->add_group_control( |
| 666 | \Elementor\Group_Control_Typography::get_type(), |
| 667 | [ |
| 668 | 'name' => 'tabs_content_typo', |
| 669 | 'selector' => '{{WRAPPER}} .tab-content .tab_style', |
| 670 | 'separator' => 'before', |
| 671 | ] |
| 672 | ); |
| 673 | |
| 674 | $this->add_control( |
| 675 | 'tabs_content_text_color', [ |
| 676 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 677 | 'type' => Controls_Manager::COLOR, |
| 678 | 'selectors' => array( |
| 679 | '{{WRAPPER}} .tab-content .tab_style' => 'color: {{VALUE}}', |
| 680 | ) |
| 681 | ] |
| 682 | ); |
| 683 | |
| 684 | $this->add_group_control( |
| 685 | Group_Control_Background::get_type(), [ |
| 686 | 'name' => 'content_background', |
| 687 | 'types' => [ 'classic', 'gradient' ], |
| 688 | 'selector' => '{{WRAPPER}} .tab-content', |
| 689 | ] |
| 690 | ); |
| 691 | |
| 692 | $this->add_group_control( |
| 693 | Group_Control_Border::get_type(), |
| 694 | [ |
| 695 | 'name' => 'tabs_border', |
| 696 | 'label' => esc_html__( 'Border', 'spider-elements' ), |
| 697 | 'selector' => '{{WRAPPER}} .tab-content', |
| 698 | ] |
| 699 | ); |
| 700 | |
| 701 | $this->add_responsive_control( |
| 702 | 'content_border_radius', |
| 703 | [ |
| 704 | 'label' => esc_html__( 'Border Radius', 'spider-elements' ), |
| 705 | 'type' => Controls_Manager::DIMENSIONS, |
| 706 | 'size_units' => [ 'px', '%', 'em' ], |
| 707 | 'selectors' => [ |
| 708 | '{{WRAPPER}} .tab-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 709 | ], |
| 710 | ] |
| 711 | ); |
| 712 | |
| 713 | $this->add_responsive_control( |
| 714 | 'content_padding', [ |
| 715 | 'label' => esc_html__( 'Padding', 'spider-elements' ), |
| 716 | 'type' => Controls_Manager::DIMENSIONS, |
| 717 | 'size_units' => [ 'px', '%', 'em' ], |
| 718 | 'selectors' => [ |
| 719 | '{{WRAPPER}} .tab-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 720 | ], |
| 721 | ] |
| 722 | ); |
| 723 | |
| 724 | $this->end_controls_section(); // End Content Section |
| 725 | |
| 726 | |
| 727 | //=============================== Style Navigation Arrow ===============================// |
| 728 | $this->start_controls_section( |
| 729 | 'style_nav_arrow', [ |
| 730 | 'label' => esc_html__( 'Navigation Arrow', 'spider-elements' ), |
| 731 | 'tab' => Controls_Manager::TAB_STYLE, |
| 732 | 'condition' => [ |
| 733 | 'is_navigation_arrow' => 'yes', |
| 734 | ], |
| 735 | ] |
| 736 | ); |
| 737 | |
| 738 | $this->start_controls_tabs( |
| 739 | 'nav_arrow_style_tabs' |
| 740 | ); |
| 741 | |
| 742 | //===== Normal Tab |
| 743 | $this->start_controls_tab( |
| 744 | 'style_tab_normal_nav_arrow', [ |
| 745 | 'label' => esc_html__( 'Normal', 'spider-elements' ), |
| 746 | ] |
| 747 | ); |
| 748 | |
| 749 | $this->add_control( |
| 750 | 'normal_nav_arrow_color', [ |
| 751 | 'label' => esc_html__( 'Color', 'spider-elements' ), |
| 752 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 753 | 'selectors' => [ |
| 754 | '{{WRAPPER}} .tab-content .tab_arrow_btn i' => 'color: {{VALUE}}', |
| 755 | ], |
| 756 | ] |
| 757 | ); |
| 758 | |
| 759 | $this->add_control( |
| 760 | 'normal_nav_arrow_bg_color', [ |
| 761 | 'label' => esc_html__( 'Background Color', 'spider-elements' ), |
| 762 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 763 | 'selectors' => [ |
| 764 | '{{WRAPPER}} .tab-content .tab_arrow_btn' => 'background: {{VALUE}}', |
| 765 | ], |
| 766 | ] |
| 767 | ); |
| 768 | |
| 769 | $this->end_controls_tab(); //End Normal Tab |
| 770 | |
| 771 | //===== Hover Tab |
| 772 | $this->start_controls_tab( |
| 773 | 'style_tab_hover_nav_arrow', |
| 774 | [ |
| 775 | 'label' => esc_html__( 'Hover', 'spider-elements' ), |
| 776 | ] |
| 777 | ); |
| 778 | |
| 779 | $this->add_control( |
| 780 | 'hover_nav_arrow_color', [ |
| 781 | 'label' => esc_html__( 'Color', 'spider-elements' ), |
| 782 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 783 | 'selectors' => [ |
| 784 | '{{WRAPPER}} .tab-content .tab_arrow_btn:hover i' => 'color: {{VALUE}}', |
| 785 | ], |
| 786 | ] |
| 787 | ); |
| 788 | |
| 789 | $this->add_control( |
| 790 | 'hover_nav_arrow_bg_color', [ |
| 791 | 'label' => esc_html__( 'Background Color', 'spider-elements' ), |
| 792 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 793 | 'selectors' => [ |
| 794 | '{{WRAPPER}} .tab-content .tab_arrow_btn:hover' => 'background: {{VALUE}}', |
| 795 | ], |
| 796 | ] |
| 797 | ); |
| 798 | |
| 799 | $this->end_controls_tab(); // End Hover Tab |
| 800 | |
| 801 | $this->end_controls_tabs(); // End Style Tabs |
| 802 | |
| 803 | $this->end_controls_section(); // End Navigation Arrow |
| 804 | |
| 805 | } |
| 806 | |
| 807 | |
| 808 | /** |
| 809 | * Name: elementor_render() |
| 810 | * Desc: Render the widget output on the frontend. |
| 811 | * Params: no params |
| 812 | * Return: @void |
| 813 | * Since: @1.0.0 |
| 814 | * Package: @spider-elements |
| 815 | * Author: spider-themes |
| 816 | */ |
| 817 | protected function render(): void |
| 818 | { |
| 819 | |
| 820 | $settings = $this->get_settings_for_display(); |
| 821 | extract( $settings ); //extract all settings array to variables converted to name of key |
| 822 | |
| 823 | $tabs = $this->get_settings_for_display( 'tabs' ); |
| 824 | $id_int = substr( $this->get_id_int(), 0, 3 ); |
| 825 | |
| 826 | $navigation_arrow_class = ! empty( $is_navigation_arrow == 'yes' ) ? ' process_tab_shortcode' : ''; |
| 827 | $sticky_tab_class = ! empty( $is_sticky_tab == 'yes' ) ? ' sticky_tab' : ''; |
| 828 | $tab_auto_class = ! empty( $is_auto_play == 'yes' ) ? ' tab_auto_play' : ''; |
| 829 | $data_auto_play = ! empty( $is_auto_play == 'yes' ) ? ' data-autoplay=yes' : ''; |
| 830 | |
| 831 | //================= Template Parts =================// |
| 832 | // Whitelist valid style values to prevent Local File Inclusion |
| 833 | $allowed_styles = array( '1', '2' ); |
| 834 | $style = isset( $settings['style'] ) && in_array( $settings['style'], $allowed_styles, true ) ? $settings['style'] : '1'; |
| 835 | include __DIR__ . "/templates/tabs/tab-{$style}.php"; |
| 836 | |
| 837 | } |
| 838 | |
| 839 | |
| 840 | } |