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