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