templates
2 years ago
Accordion.php
2 years ago
Alerts_Box.php
2 years ago
Animated_Heading.php
2 years ago
Before_after.php
2 years ago
Blog_Grid.php
2 years ago
Buttons.php
2 years ago
Cheat_sheet.php
2 years ago
Counter.php
2 years ago
Fullscreen_Slider.php
2 years ago
Icon_box.php
2 years ago
Instagram.php
2 years ago
Integrations.php
2 years ago
List_Item.php
2 years ago
Marquee_Slides.php
2 years ago
Pricing_Table_Switcher.php
2 years ago
Pricing_Table_Tabs.php
2 years ago
Skill_Showcase.php
2 years ago
Tabs.php
2 years ago
Team_Carousel.php
2 years ago
Testimonial.php
2 years ago
Timeline.php
2 years ago
Video_Playlist.php
2 years ago
Video_Popup.php
2 years ago
Accordion.php
657 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Use namespace to avoid conflict |
| 4 | */ |
| 5 | |
| 6 | namespace SPEL\Widgets; |
| 7 | |
| 8 | use Elementor\Controls_Manager; |
| 9 | use Elementor\Group_Control_Text_Shadow; |
| 10 | use Elementor\Group_Control_Text_Stroke; |
| 11 | use Elementor\Group_Control_Typography; |
| 12 | use Elementor\Repeater; |
| 13 | use Elementor\Widget_Base; |
| 14 | |
| 15 | |
| 16 | // Exit if accessed directly |
| 17 | if ( ! defined( 'ABSPATH' ) ) { |
| 18 | exit; |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * Class Accordion |
| 23 | * @package spider\Widgets |
| 24 | */ |
| 25 | class Accordion extends Widget_Base { |
| 26 | |
| 27 | public function get_name() { |
| 28 | return 'spel_accordion'; // ID of the widget (Don't change this name) |
| 29 | } |
| 30 | |
| 31 | public function get_title() { |
| 32 | return esc_html__( 'Accordion', 'spider-elements' ); |
| 33 | } |
| 34 | |
| 35 | public function get_icon() { |
| 36 | return 'eicon-accordion spel-icon'; |
| 37 | } |
| 38 | |
| 39 | public function get_keywords() { |
| 40 | return [ 'spider', 'spider elements', 'toggle', 'accordion', 'collapse', 'faq', 'tabs', 'tab', ]; |
| 41 | } |
| 42 | |
| 43 | public function get_categories() { |
| 44 | return [ 'spider-elements' ]; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Name: get_style_depends() |
| 49 | * Desc: Register the required CSS dependencies for the frontend. |
| 50 | */ |
| 51 | public function get_style_depends() { |
| 52 | return [ 'spel-main', 'elegant-icon' ]; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Name: get_script_depends() |
| 57 | * Desc: Register the required JS dependencies for the frontend. |
| 58 | */ |
| 59 | public function get_script_depends() { |
| 60 | return [ 'spel-el-widgets', 'spel-script' ]; |
| 61 | } |
| 62 | |
| 63 | |
| 64 | /** |
| 65 | * Name: register_controls() |
| 66 | * Desc: Register controls for these widgets |
| 67 | * Params: no params |
| 68 | * Return: @void |
| 69 | * Since: @1.0.0 |
| 70 | * Package: @spider-elements |
| 71 | * Author: spider-themes |
| 72 | */ |
| 73 | protected function register_controls() { |
| 74 | $this->elementor_content_control(); |
| 75 | $this->elementor_style_control(); |
| 76 | } |
| 77 | |
| 78 | |
| 79 | /** |
| 80 | * Name: elementor_content_control() |
| 81 | * Desc: Register the Content Tab output on the Elementor editor. |
| 82 | * Params: no params |
| 83 | * Return: @void |
| 84 | * Since: @1.0.0 |
| 85 | * Package: @spider-elements |
| 86 | * Author: spider-themes |
| 87 | */ |
| 88 | public function elementor_content_control() { |
| 89 | |
| 90 | //=================== Section Accordion ===================// |
| 91 | $this->start_controls_section( |
| 92 | 'sec_accordion', [ |
| 93 | 'label' => esc_html__( 'Accordion', 'spider-elements' ), |
| 94 | ] |
| 95 | ); |
| 96 | |
| 97 | $repeater = new Repeater(); |
| 98 | $repeater->add_control( |
| 99 | 'collapse_state', [ |
| 100 | 'label' => esc_html__( 'Expanded', 'spider-elements' ), |
| 101 | 'type' => Controls_Manager::SWITCHER, |
| 102 | 'label_on' => esc_html__( 'Yes', 'spider-elements' ), |
| 103 | 'label_off' => esc_html__( 'No', 'spider-elements' ), |
| 104 | 'return_value' => 'yes', |
| 105 | 'default' => 'no', |
| 106 | 'separator' => 'after', |
| 107 | ] |
| 108 | ); |
| 109 | |
| 110 | $repeater->add_control( |
| 111 | 'title', [ |
| 112 | 'label' => esc_html__( 'Title', 'spider-elements' ), |
| 113 | 'type' => Controls_Manager::TEXT, |
| 114 | 'default' => esc_html__( 'Accordion Title', 'spider-elements' ), |
| 115 | 'label_block' => true, |
| 116 | 'dynamic' => [ |
| 117 | 'active' => true, |
| 118 | ], |
| 119 | ] |
| 120 | ); |
| 121 | |
| 122 | $repeater->add_control( |
| 123 | 'content_type', [ |
| 124 | 'label' => esc_html__( 'Content Type', 'spider-elements' ), |
| 125 | 'type' => Controls_Manager::SELECT, |
| 126 | 'options' => [ |
| 127 | 'content' => esc_html__( 'Contents', 'spider-elements' ), |
| 128 | 'el_template' => esc_html__( 'Saved Template', 'spider-elements' ), |
| 129 | ], |
| 130 | 'default' => 'content', |
| 131 | ] |
| 132 | ); |
| 133 | |
| 134 | $repeater->add_control( |
| 135 | 'normal_content', [ |
| 136 | 'label' => esc_html__( 'Content Text', 'spider-elements' ), |
| 137 | 'type' => Controls_Manager::WYSIWYG, |
| 138 | 'label_block' => true, |
| 139 | 'default' => esc_html__( 'Accordion Content', 'spider-elements' ), |
| 140 | 'condition' => [ |
| 141 | 'content_type' => 'content' |
| 142 | ] |
| 143 | ] |
| 144 | |
| 145 | ); |
| 146 | |
| 147 | $repeater->add_control( |
| 148 | 'el_content', [ |
| 149 | 'label' => esc_html__( 'Select Template', 'spider-elements' ), |
| 150 | 'type' => Controls_Manager::SELECT, |
| 151 | 'options' => spel_get_el_templates(), |
| 152 | 'label_block' => true, |
| 153 | 'default' => esc_html__( 'Accordion Content', 'spider-elements' ), |
| 154 | 'condition' => [ |
| 155 | 'content_type' => 'el_template' |
| 156 | ] |
| 157 | ] |
| 158 | ); |
| 159 | |
| 160 | $this->add_control( |
| 161 | 'accordions', [ |
| 162 | 'label' => 'Accordion Items', |
| 163 | 'type' => Controls_Manager::REPEATER, |
| 164 | 'fields' => $repeater->get_controls(), |
| 165 | 'default' => [ |
| 166 | [ |
| 167 | 'title' => esc_html__( 'Accordion #1', 'spider-elements' ), |
| 168 | 'tab_content' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', |
| 169 | 'spider-elements' ), |
| 170 | ], |
| 171 | [ |
| 172 | 'title' => esc_html__( 'Accordion #2', 'spider-elements' ), |
| 173 | 'tab_content' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', |
| 174 | 'spider-elements' ), |
| 175 | ], |
| 176 | [ |
| 177 | 'title' => esc_html__( 'Accordion #3', 'spider-elements' ), |
| 178 | 'tab_content' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', |
| 179 | 'spider-elements' ), |
| 180 | ], |
| 181 | ], |
| 182 | 'title_field' => '{{{ title }}}', |
| 183 | ] |
| 184 | ); |
| 185 | |
| 186 | $this->add_control( |
| 187 | 'plus-icon', [ |
| 188 | 'label' => esc_html__( 'Icon', 'spider-elements' ), |
| 189 | 'type' => Controls_Manager::ICONS, |
| 190 | 'label_block' => true, |
| 191 | 'default' => [ |
| 192 | 'value' => 'icon_plus', |
| 193 | 'library' => 'solid', |
| 194 | ], |
| 195 | 'separator' => 'before' |
| 196 | ] |
| 197 | ); |
| 198 | |
| 199 | $this->add_control( |
| 200 | 'minus-icon', [ |
| 201 | 'label' => esc_html__( 'Active Icon', 'spider-elements' ), |
| 202 | 'type' => Controls_Manager::ICONS, |
| 203 | 'default' => [ |
| 204 | 'value' => 'icon_minus-06', |
| 205 | 'library' => 'solid', |
| 206 | ] |
| 207 | ] |
| 208 | ); |
| 209 | |
| 210 | $this->add_control( |
| 211 | 'icon_align', |
| 212 | [ |
| 213 | 'label' => esc_html__( 'Icon Alignment', 'spider-elements' ), |
| 214 | 'type' => Controls_Manager::CHOOSE, |
| 215 | 'options' => [ |
| 216 | 'left' => [ |
| 217 | 'title' => esc_html__( 'Start', 'spider-elements' ), |
| 218 | 'icon' => 'eicon-h-align-left' |
| 219 | ], |
| 220 | 'right' => [ |
| 221 | 'title' => esc_html__( 'End', 'spider-elements' ), |
| 222 | 'icon' => 'eicon-h-align-right' |
| 223 | ], |
| 224 | ], |
| 225 | 'default' => is_rtl() ? 'left' : 'right', |
| 226 | 'toggle' => false, |
| 227 | ] |
| 228 | ); |
| 229 | |
| 230 | $this->add_responsive_control( |
| 231 | 'icon_space', |
| 232 | [ |
| 233 | 'label' => esc_html__( 'Icon Spacing', 'spider-elements' ), |
| 234 | 'type' => Controls_Manager::SLIDER, |
| 235 | 'size_units' => [ 'px', '%', 'em' ], |
| 236 | 'range' => [ |
| 237 | 'px' => [ |
| 238 | 'min' => 0, |
| 239 | 'max' => 500, |
| 240 | ], |
| 241 | ], |
| 242 | 'default' => [ |
| 243 | 'size' => 30, |
| 244 | 'unit' => 'px', |
| 245 | ], |
| 246 | 'selectors' => [ |
| 247 | '{{WRAPPER}} .doc_accordion .card-header button .expanded-icon' => 'margin-right: {{SIZE}}{{UNIT}};', |
| 248 | '{{WRAPPER}} .doc_accordion .card-header button .collapsed-icon' => 'margin-right: {{SIZE}}{{UNIT}};', |
| 249 | '{{WRAPPER}} .doc_accordion .card-header button.icon-align-left .expanded-icon' => 'margin-left: {{SIZE}}{{UNIT}};', |
| 250 | '{{WRAPPER}} .doc_accordion .card-header button.icon-align-left .collapsed-icon' => 'margin-left: {{SIZE}}{{UNIT}};', |
| 251 | ], |
| 252 | ] |
| 253 | ); |
| 254 | |
| 255 | $this->add_control( |
| 256 | 'is_toggle', [ |
| 257 | 'label' => esc_html__( 'Toggle', 'spider-elements' ), |
| 258 | 'type' => Controls_Manager::SWITCHER, |
| 259 | 'separator' => 'before', |
| 260 | 'label_on' => esc_html__( 'Yes', 'spider-elements' ), |
| 261 | 'label_off' => esc_html__( 'No', 'spider-elements' ), |
| 262 | 'return_value' => 'yes', |
| 263 | 'default' => '', |
| 264 | ] |
| 265 | ); |
| 266 | |
| 267 | $this->add_control( |
| 268 | 'faq_schema', |
| 269 | [ |
| 270 | 'label' => esc_html__( 'FAQ Schema', 'spider-elements' ), |
| 271 | 'type' => Controls_Manager::SWITCHER, |
| 272 | 'separator' => 'before', |
| 273 | ] |
| 274 | ); |
| 275 | |
| 276 | $this->add_control( |
| 277 | 'title_tag', [ |
| 278 | 'label' => esc_html__( 'Title Tag', 'spider-elements' ), |
| 279 | 'type' => Controls_Manager::SELECT, |
| 280 | 'separator' => 'before', |
| 281 | 'default' => 'h6', |
| 282 | 'options' => spel_get_title_tags(), |
| 283 | ] |
| 284 | ); |
| 285 | |
| 286 | $this->end_controls_section(); // End Accordion Settings |
| 287 | |
| 288 | } |
| 289 | |
| 290 | |
| 291 | /** |
| 292 | * Name: elementor_style_control() |
| 293 | * Desc: Register the Style Tab output on the Elementor editor. |
| 294 | * Params: no params |
| 295 | * Return: @void |
| 296 | * Since: @1.0.0 |
| 297 | * Package: @spider-elements |
| 298 | * Author: spider-themes |
| 299 | */ |
| 300 | // ==================Start accordion all style controls=============== |
| 301 | public function elementor_style_control() { |
| 302 | |
| 303 | //============================= Accordion Settings Style =============================// |
| 304 | $this->start_controls_section( |
| 305 | 'sec_title_style', [ |
| 306 | 'label' => esc_html__( 'Accordion', 'spider-elements' ), |
| 307 | 'tab' => Controls_Manager::TAB_STYLE, |
| 308 | ] |
| 309 | ); |
| 310 | |
| 311 | $this->add_group_control( |
| 312 | \Elementor\Group_Control_Border::get_type(), |
| 313 | [ |
| 314 | 'name' => 'accordion_border', |
| 315 | 'label' => esc_html__( 'Border', 'spider-elements' ), |
| 316 | 'selector' => '{{WRAPPER}} .accordion .doc_accordion', |
| 317 | ] |
| 318 | ); |
| 319 | |
| 320 | $this->add_control( |
| 321 | 'is_border_bottom', [ |
| 322 | 'label' => esc_html__( 'Border Bottom', 'spider-elements' ), |
| 323 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 324 | 'label_on' => esc_html__( 'Yes', 'spider-elements' ), |
| 325 | 'label_off' => esc_html__( 'No', 'spider-elements' ), |
| 326 | 'return_value' => 'yes', |
| 327 | 'default' => 'yes', |
| 328 | ] |
| 329 | ); |
| 330 | |
| 331 | |
| 332 | $this->add_responsive_control( |
| 333 | 'acc_item_border_radius', [ |
| 334 | 'label' => esc_html__( 'Border Radius', 'spider-elements' ), |
| 335 | 'type' => Controls_Manager::DIMENSIONS, |
| 336 | 'size_units' => [ 'px', '%', 'em' ], |
| 337 | 'selectors' => [ |
| 338 | '{{WRAPPER}} .accordion .doc_accordion' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 339 | ], |
| 340 | ] |
| 341 | ); |
| 342 | |
| 343 | $this->add_responsive_control( |
| 344 | 'accordion_bottom_spacing', |
| 345 | [ |
| 346 | 'label' => esc_html__( 'Spacing', 'spider-elements' ), |
| 347 | 'description' => esc_html__( 'Spacing between the accordions', 'spider-elements' ), |
| 348 | 'type' => Controls_Manager::SLIDER, |
| 349 | 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], |
| 350 | 'range' => [ |
| 351 | 'px' => [ |
| 352 | 'max' => 100, |
| 353 | ], |
| 354 | 'em' => [ |
| 355 | 'max' => 0, |
| 356 | ], |
| 357 | ], |
| 358 | 'selectors' => [ |
| 359 | '{{WRAPPER}} .accordion .doc_accordion' => 'margin-bottom: {{SIZE}}{{UNIT}} !important;', |
| 360 | ], |
| 361 | ] |
| 362 | ); |
| 363 | |
| 364 | $this->end_controls_section(); |
| 365 | |
| 366 | |
| 367 | // =============Accordion Title Style Section=============== |
| 368 | $this->start_controls_section( |
| 369 | 'section_toggle_style_title', |
| 370 | [ |
| 371 | 'label' => esc_html__( 'Title', 'spider-elements' ), |
| 372 | 'tab' => Controls_Manager::TAB_STYLE, |
| 373 | ] |
| 374 | ); |
| 375 | |
| 376 | $this->add_group_control( |
| 377 | Group_Control_Typography::get_type(), [ |
| 378 | 'name' => 'title_typography', |
| 379 | 'selector' => '{{WRAPPER}} .doc_accordion .card-header button.collapsed, {{WRAPPER}} .doc_accordion .card-header button', |
| 380 | ] |
| 381 | ); |
| 382 | |
| 383 | $this->add_control( |
| 384 | 'title_color', |
| 385 | [ |
| 386 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 387 | 'type' => Controls_Manager::COLOR, |
| 388 | 'selectors' => [ |
| 389 | '{{WRAPPER}} .accordion .spe_accordion_inner button.btn' => 'color: {{VALUE}};', |
| 390 | ], |
| 391 | ] |
| 392 | ); |
| 393 | |
| 394 | $this->add_control( |
| 395 | 'tab_active_color', |
| 396 | [ |
| 397 | 'label' => esc_html__( 'Active Text', 'spider-elements' ), |
| 398 | 'type' => Controls_Manager::COLOR, |
| 399 | 'selectors' => [ |
| 400 | '{{WRAPPER}} .accordion .spe-collapsed button.btn' => 'color: {{VALUE}};', |
| 401 | ], |
| 402 | ] |
| 403 | ); |
| 404 | |
| 405 | $this->add_group_control( |
| 406 | \Elementor\Group_Control_Background::get_type(), |
| 407 | [ |
| 408 | 'name' => 'accordion_title_bg_color', |
| 409 | 'types' => [ 'classic', 'gradient' ], |
| 410 | 'exclude' => [ 'image' ], |
| 411 | 'selector' => '{{WRAPPER}} .doc_accordion .card-header button.collapsed, {{WRAPPER}} .doc_accordion .card-header button', |
| 412 | ] |
| 413 | ); |
| 414 | |
| 415 | $this->add_group_control( |
| 416 | Group_Control_Text_Stroke::get_type(), [ |
| 417 | 'name' => 'text_stroke', |
| 418 | 'selector' => '{{WRAPPER}} .doc_accordion .card-header button.collapsed, {{WRAPPER}} .doc_accordion .card-header button', |
| 419 | ] |
| 420 | ); |
| 421 | |
| 422 | $this->add_group_control( |
| 423 | Group_Control_Text_Shadow::get_type(), |
| 424 | [ |
| 425 | 'name' => 'title_shadow', |
| 426 | 'selector' => '{{WRAPPER}} .doc_accordion .card-header button.collapsed, {{WRAPPER}} .doc_accordion .card-header button', |
| 427 | ] |
| 428 | ); |
| 429 | |
| 430 | $this->add_responsive_control( |
| 431 | 'title_padding', |
| 432 | [ |
| 433 | 'label' => esc_html__( 'Padding', 'spider-elements' ), |
| 434 | 'type' => Controls_Manager::DIMENSIONS, |
| 435 | 'size_units' => [ 'px', 'em', '%' ], |
| 436 | 'selectors' => [ |
| 437 | '{{WRAPPER}} .doc_accordion .card-header button.collapsed' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 438 | '{{WRAPPER}} .doc_accordion .card-header button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 439 | ], |
| 440 | ] |
| 441 | ); |
| 442 | |
| 443 | $this->end_controls_section(); |
| 444 | //end accordion title style section///// |
| 445 | |
| 446 | // ===========Accordion Content Style Section========== |
| 447 | $this->start_controls_section( |
| 448 | 'section_toggle_style_content', |
| 449 | [ |
| 450 | 'label' => esc_html__( 'Content', 'spider-elements' ), |
| 451 | 'tab' => Controls_Manager::TAB_STYLE, |
| 452 | ] |
| 453 | ); |
| 454 | |
| 455 | $this->add_group_control( |
| 456 | Group_Control_Typography::get_type(), [ |
| 457 | 'name' => 'content_typography', |
| 458 | 'selector' => '{{WRAPPER}} .elementor-widget-container .toggle_body', |
| 459 | ] |
| 460 | ); |
| 461 | |
| 462 | $this->add_control( |
| 463 | 'content_color', |
| 464 | [ |
| 465 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 466 | 'type' => Controls_Manager::COLOR, |
| 467 | 'selectors' => [ |
| 468 | '{{WRAPPER}} .elementor-widget-container .toggle_body' => 'color: {{VALUE}};', |
| 469 | ], |
| 470 | ] |
| 471 | ); |
| 472 | |
| 473 | $this->add_group_control( |
| 474 | \Elementor\Group_Control_Background::get_type(), |
| 475 | [ |
| 476 | 'name' => 'accordion_content_bg_color', |
| 477 | 'types' => [ 'classic', 'gradient' ], |
| 478 | 'exclude' => [ 'image' ], |
| 479 | 'selector' => '{{WRAPPER}} .elementor-widget-container .toggle_body ', |
| 480 | ] |
| 481 | ); |
| 482 | |
| 483 | $this->add_group_control( |
| 484 | Group_Control_Text_Shadow::get_type(), |
| 485 | [ |
| 486 | 'name' => 'content_shadow', |
| 487 | 'selector' => '{{WRAPPER}} .elementor-widget-container .toggle_body', |
| 488 | ] |
| 489 | ); |
| 490 | |
| 491 | $this->add_responsive_control( |
| 492 | 'content_padding', |
| 493 | [ |
| 494 | 'label' => esc_html__( 'Padding', 'spider-elements' ), |
| 495 | 'type' => Controls_Manager::DIMENSIONS, |
| 496 | 'size_units' => [ 'px', 'em', '%' ], |
| 497 | 'selectors' => [ |
| 498 | '{{WRAPPER}} .elementor-widget-container .toggle_body' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 499 | ], |
| 500 | ] |
| 501 | ); |
| 502 | |
| 503 | $this->end_controls_section(); |
| 504 | //end accordion content style section// |
| 505 | |
| 506 | |
| 507 | // ============Accordion Icon Style Section============== |
| 508 | $this->start_controls_section( |
| 509 | 'section_toggle_style_icon', |
| 510 | [ |
| 511 | 'label' => esc_html__( 'Icon', 'spider-elements' ), |
| 512 | 'tab' => Controls_Manager::TAB_STYLE |
| 513 | ] |
| 514 | ); |
| 515 | |
| 516 | $this->add_group_control( |
| 517 | Group_Control_Typography::get_type(), [ |
| 518 | 'name' => 'icon_typography', |
| 519 | 'selector' => '{{WRAPPER}} .expanded-icon, {{WRAPPER}} .collapsed-icon', |
| 520 | ] |
| 521 | ); |
| 522 | |
| 523 | |
| 524 | // Accordion icon Normal/Active/ State |
| 525 | $this->start_controls_tabs( |
| 526 | 'style_accordion_icon_tabs' |
| 527 | ); |
| 528 | |
| 529 | //=== Normal icon |
| 530 | $this->start_controls_tab( |
| 531 | 'style_accordion_icon_normal', |
| 532 | [ |
| 533 | 'label' => esc_html__( 'Normal', 'spider-elements' ), |
| 534 | ] |
| 535 | ); |
| 536 | |
| 537 | $this->add_control( |
| 538 | 'acc_icon_color', |
| 539 | [ |
| 540 | 'label' => esc_html__( 'Icon Color', 'spider-elements' ), |
| 541 | 'type' => Controls_Manager::COLOR, |
| 542 | 'selectors' => [ |
| 543 | '{{WRAPPER}} .card-header button .expanded-icon' => 'color: {{VALUE}};', |
| 544 | |
| 545 | ], |
| 546 | ] |
| 547 | ); |
| 548 | |
| 549 | $this->add_control( |
| 550 | 'acc_icon_bg_color', |
| 551 | [ |
| 552 | 'label' => esc_html__( 'Background', 'spider-elements' ), |
| 553 | 'type' => Controls_Manager::COLOR, |
| 554 | 'selectors' => [ |
| 555 | '{{WRAPPER}} .doc_accordion .card-header button .expanded-icon' => 'background: {{VALUE}};', |
| 556 | |
| 557 | ], |
| 558 | ] |
| 559 | ); |
| 560 | |
| 561 | $this->end_controls_tab(); //End Normal icon |
| 562 | |
| 563 | |
| 564 | //=== Active icon==== |
| 565 | $this->start_controls_tab( |
| 566 | 'acc_icon_active', [ |
| 567 | 'label' => esc_html__( 'Active', 'spider-elements' ), |
| 568 | ] |
| 569 | ); |
| 570 | |
| 571 | $this->add_control( |
| 572 | 'icon_active_color', [ |
| 573 | 'label' => esc_html__( 'Active Color', 'spider-elements' ), |
| 574 | 'type' => Controls_Manager::COLOR, |
| 575 | 'selectors' => [ |
| 576 | '{{WRAPPER}} .card-header button .collapsed-icon' => 'color: {{VALUE}};', |
| 577 | ], |
| 578 | ] |
| 579 | ); |
| 580 | |
| 581 | $this->add_control( |
| 582 | 'icon_active_bg_color', [ |
| 583 | 'label' => esc_html__( 'Background', 'spider-elements' ), |
| 584 | 'type' => Controls_Manager::COLOR, |
| 585 | 'selectors' => [ |
| 586 | '{{WRAPPER}} .doc_accordion .card-header button .collapsed-icon' => 'background: {{VALUE}};', |
| 587 | ], |
| 588 | ] |
| 589 | ); |
| 590 | |
| 591 | |
| 592 | $this->end_controls_tab(); // End Active Tab Title |
| 593 | $this->end_controls_tabs(); // End Accordion icon Normal/Active/ State |
| 594 | |
| 595 | $this->add_responsive_control( |
| 596 | 'acc_padding', |
| 597 | [ |
| 598 | 'label' => esc_html__( 'Padding', 'spider-elements' ), |
| 599 | 'type' => Controls_Manager::DIMENSIONS, |
| 600 | 'size_units' => [ 'px', 'em', '%' ], |
| 601 | 'separator' => 'before', |
| 602 | 'selectors' => [ |
| 603 | '{{WRAPPER}} .doc_accordion .card-header button .expanded-icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 604 | '{{WRAPPER}} .doc_accordion .card-header button .collapsed-icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 605 | ], |
| 606 | ] |
| 607 | ); |
| 608 | |
| 609 | $this->add_responsive_control( |
| 610 | 'acc_border_radius', |
| 611 | [ |
| 612 | 'label' => esc_html__( 'Border Radius', 'spider-elements' ), |
| 613 | 'type' => Controls_Manager::SLIDER, |
| 614 | 'size_units' => [ 'px', '%', 'em' ], |
| 615 | 'selectors' => [ |
| 616 | '{{WRAPPER}} .doc_accordion .card-header button .expanded-icon' => 'border-radius: {{SIZE}}px;', |
| 617 | '{{WRAPPER}} .doc_accordion .card-header button .collapsed-icon' => 'border-radius: {{SIZE}}px;', |
| 618 | ], |
| 619 | ] |
| 620 | ); |
| 621 | |
| 622 | $this->end_controls_section(); |
| 623 | //end accordion icon style section// |
| 624 | |
| 625 | } |
| 626 | // ==================End accordion all style controls=============== |
| 627 | |
| 628 | |
| 629 | /** |
| 630 | * Name: elementor_render() |
| 631 | * Desc: Render the widget output on the frontend. |
| 632 | * Params: no params |
| 633 | * Return: @void |
| 634 | * Since: @1.0.0 |
| 635 | * Package: @spider-elements |
| 636 | * Author: spider-themes |
| 637 | */ |
| 638 | protected function render() { |
| 639 | $settings = $this->get_settings_for_display(); |
| 640 | extract( $settings ); |
| 641 | |
| 642 | $title_tag = ! empty ( $settings['title_tag'] ) ? $settings['title_tag'] : 'h6'; |
| 643 | $accordions = ! empty ( $settings['accordions'] ) ? $settings['accordions'] : ''; |
| 644 | $icon_align = ! empty ( $settings['icon_align'] ) ? $settings['icon_align'] : 'right'; |
| 645 | $icon_align_class = ! empty ( $icon_align == 'left' ) ? ' icon-align-left' : ''; |
| 646 | |
| 647 | $is_toggle = ! empty ( $settings['is_toggle'] ) ? $settings['is_toggle'] : ''; |
| 648 | $toggle_id = ! empty( $is_toggle == 'yes' ) ? 'id=accordionExample-' . $this->get_id() : ''; |
| 649 | $toggle_bs_parent_id = ! empty( $is_toggle == 'yes' ) ? 'data-bs-parent=#accordionExample-' . $this->get_id() : ''; |
| 650 | |
| 651 | //======================== Template Parts ========================// |
| 652 | include "templates/accordion/accordion.php"; |
| 653 | |
| 654 | } |
| 655 | } |
| 656 | |
| 657 |