theme-elements
6 months ago
accordion.php
6 months ago
audio.php
6 months ago
before-after.php
6 months ago
button.php
6 months ago
carousel-navigation.php
6 months ago
circle-chart.php
6 months ago
contact-box.php
6 months ago
contact-form.php
6 months ago
custom-list.php
6 months ago
divider.php
6 months ago
gallery.php
6 months ago
gmap.php
2 days ago
heading-modern.php
5 months ago
icon.php
6 months ago
image.php
6 months ago
mailchimp.php
6 months ago
modern-button.php
6 months ago
products-grid.php
6 months ago
quote.php
6 months ago
recent-comments.php
6 months ago
recent-posts-grid-carousel.php
1 month ago
recent-posts-land-style.php
6 months ago
recent-posts-masonry.php
6 months ago
recent-posts-tiles-carousel.php
6 months ago
recent-posts-tiles.php
6 months ago
recent-posts-timeline.php
6 months ago
recent-products.php
6 months ago
responsive-table.php
6 months ago
search.php
6 months ago
staff.php
6 months ago
svg.php
6 months ago
tabs.php
6 months ago
testimonial.php
6 months ago
text.php
6 months ago
touch-slider.php
6 months ago
video.php
6 months ago
accordion.php
807 lines
| 1 | <?php |
| 2 | namespace Auxin\Plugin\CoreElements\Elementor\Elements; |
| 3 | |
| 4 | use Elementor\Plugin; |
| 5 | use Elementor\Widget_Base; |
| 6 | use Elementor\Controls_Manager; |
| 7 | use Elementor\Group_Control_Typography; |
| 8 | use Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 9 | use Elementor\Group_Control_Border; |
| 10 | use Elementor\Group_Control_Box_Shadow; |
| 11 | use Elementor\Group_Control_Background; |
| 12 | |
| 13 | |
| 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | exit; // Exit if accessed directly. |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Elementor 'Accordion' widget. |
| 20 | * |
| 21 | * Elementor widget that displays an 'Accordion' with lightbox. |
| 22 | * |
| 23 | * @since 1.0.0 |
| 24 | */ |
| 25 | class Accordion extends Widget_Base { |
| 26 | |
| 27 | /** |
| 28 | * Get widget name. |
| 29 | * |
| 30 | * Retrieve 'Accordion' widget name. |
| 31 | * |
| 32 | * @since 1.0.0 |
| 33 | * @access public |
| 34 | * |
| 35 | * @return string Widget name. |
| 36 | */ |
| 37 | public function get_name() { |
| 38 | return 'aux_accordion'; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Get widget title. |
| 43 | * |
| 44 | * Retrieve 'Accordion' widget title. |
| 45 | * |
| 46 | * @since 1.0.0 |
| 47 | * @access public |
| 48 | * |
| 49 | * @return string Widget title. |
| 50 | */ |
| 51 | public function get_title() { |
| 52 | return __('Accordion', 'auxin-elements' ); |
| 53 | } |
| 54 | |
| 55 | public function has_widget_inner_wrapper(): bool { |
| 56 | return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 57 | } |
| 58 | |
| 59 | |
| 60 | /** |
| 61 | * Get widget icon. |
| 62 | * |
| 63 | * Retrieve 'Accordion' widget icon. |
| 64 | * |
| 65 | * @since 1.0.0 |
| 66 | * @access public |
| 67 | * |
| 68 | * @return string Widget icon. |
| 69 | */ |
| 70 | public function get_icon() { |
| 71 | return 'eicon-accordion auxin-badge'; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Get widget categories. |
| 76 | * |
| 77 | * Retrieve 'Accordion' widget icon. |
| 78 | * |
| 79 | * @since 1.0.0 |
| 80 | * @access public |
| 81 | * |
| 82 | * @return string Widget icon. |
| 83 | */ |
| 84 | public function get_categories() { |
| 85 | return array( 'auxin-core' ); |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Register 'Accordion' widget controls. |
| 90 | * |
| 91 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 92 | * |
| 93 | * @since 1.0.0 |
| 94 | * @access protected |
| 95 | */ |
| 96 | protected function register_controls() { |
| 97 | |
| 98 | /*-----------------------------------------------------------------------------------*/ |
| 99 | /* Content TAB |
| 100 | /*-----------------------------------------------------------------------------------*/ |
| 101 | |
| 102 | $this->start_controls_section( |
| 103 | 'tab_items_section', |
| 104 | array( |
| 105 | 'label' => __('Content', 'auxin-elements' ), |
| 106 | ) |
| 107 | ); |
| 108 | |
| 109 | $this->add_control( |
| 110 | 'tab_items', |
| 111 | array( |
| 112 | 'label' => __( 'Accordion Items', 'auxin-elements' ), |
| 113 | 'type' => Controls_Manager::REPEATER, |
| 114 | 'default' => array( |
| 115 | array( |
| 116 | 'accordion_label' => __( 'Accordion #1', 'auxin-elements' ), |
| 117 | 'content' => __( 'Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'auxin-elements' ) |
| 118 | ), |
| 119 | array( |
| 120 | 'accordion_label' => __( 'Accordion #2', 'auxin-elements' ), |
| 121 | 'content' => __( 'Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'auxin-elements' ) |
| 122 | ) |
| 123 | ), |
| 124 | 'fields' => array( |
| 125 | array( |
| 126 | 'name' => 'accordion_label', |
| 127 | 'label' => __( 'Title & Content', 'auxin-elements' ), |
| 128 | 'type' => Controls_Manager::TEXT, |
| 129 | 'default' => __( 'Accordion Title' , 'auxin-elements' ), |
| 130 | 'dynamic' => array( |
| 131 | 'active' => true |
| 132 | ), |
| 133 | 'label_block' => true |
| 134 | ), |
| 135 | array( |
| 136 | 'name' => 'content', |
| 137 | 'label' => __( 'Content', 'auxin-elements' ), |
| 138 | 'type' => Controls_Manager::WYSIWYG, |
| 139 | 'default' => __( 'Accordion Content', 'auxin-elements' ), |
| 140 | 'show_label' => false, |
| 141 | ) |
| 142 | ), |
| 143 | 'title_field' => '{{{ accordion_label }}}' |
| 144 | ) |
| 145 | ); |
| 146 | |
| 147 | $this->add_control( |
| 148 | 'type', |
| 149 | array( |
| 150 | 'label' => __('Type','auxin-elements' ), |
| 151 | 'label_block' => true, |
| 152 | 'type' => Controls_Manager::SELECT, //'aux-visual-select', |
| 153 | 'options' => array( |
| 154 | 'false' => __('Toggle', 'auxin-elements'), |
| 155 | 'true' => __('Accordion (auto close other open tabs)', 'auxin-elements') |
| 156 | ), |
| 157 | 'default' => 'true' |
| 158 | ) |
| 159 | ); |
| 160 | |
| 161 | $this->add_control( |
| 162 | 'title_tag', |
| 163 | array( |
| 164 | 'label' => __( 'Title HTML Tag', 'auxin-elements' ), |
| 165 | 'type' => Controls_Manager::SELECT, |
| 166 | 'options' => array( |
| 167 | 'div' => 'div', |
| 168 | 'section' => 'section', |
| 169 | 'h1' => 'H1', |
| 170 | 'h2' => 'H2', |
| 171 | 'h3' => 'H3', |
| 172 | 'h4' => 'H4', |
| 173 | 'h5' => 'H5', |
| 174 | 'h6' => 'H6' |
| 175 | ), |
| 176 | 'default' => 'h5' |
| 177 | ) |
| 178 | ); |
| 179 | |
| 180 | $this->end_controls_section(); |
| 181 | |
| 182 | /*-----------------------------------------------------------------------------------*/ |
| 183 | /* Style TAB |
| 184 | /*-----------------------------------------------------------------------------------*/ |
| 185 | |
| 186 | /* Accordion Item Section |
| 187 | /*-------------------------------------*/ |
| 188 | |
| 189 | $this->start_controls_section( |
| 190 | 'item_container_section', |
| 191 | array( |
| 192 | 'label' => __( 'Item Wrapper', 'auxin-elements' ), |
| 193 | 'tab' => Controls_Manager::TAB_STYLE |
| 194 | ) |
| 195 | ); |
| 196 | |
| 197 | $this->add_responsive_control( |
| 198 | 'item_container_margin', |
| 199 | array( |
| 200 | 'label' => __( 'Margin', 'auxin-elements' ), |
| 201 | 'type' => Controls_Manager::DIMENSIONS, |
| 202 | 'size_units' => array( 'px', 'em' ), |
| 203 | 'allowed_dimensions' => 'all', |
| 204 | 'selectors' => array( |
| 205 | '{{WRAPPER}} .aux-toggle-item' => 'margin:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 206 | ) |
| 207 | ) |
| 208 | ); |
| 209 | |
| 210 | $this->add_control( |
| 211 | 'item_container_border_radius', |
| 212 | array( |
| 213 | 'label' => __( 'Border Radius', 'auxin-elements' ), |
| 214 | 'type' => Controls_Manager::DIMENSIONS, |
| 215 | 'size_units' => array( 'px', 'em', '%' ), |
| 216 | 'selectors' => array( |
| 217 | '{{WRAPPER}} .aux-toggle-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow:hidden;' |
| 218 | ), |
| 219 | 'allowed_dimensions' => 'all', |
| 220 | 'separator' => 'after' |
| 221 | ) |
| 222 | ); |
| 223 | |
| 224 | $this->start_controls_tabs( 'item_container_status' ); |
| 225 | |
| 226 | $this->start_controls_tab( |
| 227 | 'item_container_status_normal', |
| 228 | array( |
| 229 | 'label' => __( 'Normal' , 'auxin-elements' ) |
| 230 | ) |
| 231 | ); |
| 232 | |
| 233 | $this->add_group_control( |
| 234 | Group_Control_Box_Shadow::get_type(), |
| 235 | array( |
| 236 | 'name' => 'item_container_boxshadow_normal', |
| 237 | 'label' => __( 'Box Shadow', 'auxin-elements' ), |
| 238 | 'selector' => '{{WRAPPER}} .aux-toggle-item', |
| 239 | 'separator' => 'none' |
| 240 | ) |
| 241 | ); |
| 242 | |
| 243 | $this->add_group_control( |
| 244 | Group_Control_Background::get_type(), |
| 245 | array( |
| 246 | 'name' => 'item_container_background_normal', |
| 247 | 'selector' => '{{WRAPPER}} .aux-toggle-item', |
| 248 | 'separator' => 'before' |
| 249 | ) |
| 250 | ); |
| 251 | |
| 252 | $this->add_group_control( |
| 253 | Group_Control_Border::get_type(), |
| 254 | array( |
| 255 | 'name' => 'item_container_border_normal', |
| 256 | 'selector' => '{{WRAPPER}} .aux-toggle-item', |
| 257 | 'separator' => 'before' |
| 258 | ) |
| 259 | ); |
| 260 | |
| 261 | $this->end_controls_tab(); |
| 262 | |
| 263 | |
| 264 | $this->start_controls_tab( |
| 265 | 'item_container_status_hover', |
| 266 | array( |
| 267 | 'label' => __( 'Hover' , 'auxin-elements' ) |
| 268 | ) |
| 269 | ); |
| 270 | |
| 271 | $this->add_group_control( |
| 272 | Group_Control_Box_Shadow::get_type(), |
| 273 | array( |
| 274 | 'name' => 'item_container_boxshadow_hover', |
| 275 | 'label' => __( 'Box Shadow', 'auxin-elements' ), |
| 276 | 'selector' => '{{WRAPPER}} .aux-toggle-item:hover', |
| 277 | 'separator' => 'none' |
| 278 | ) |
| 279 | ); |
| 280 | |
| 281 | $this->add_group_control( |
| 282 | Group_Control_Background::get_type(), |
| 283 | array( |
| 284 | 'name' => 'item_container_background_hover', |
| 285 | 'selector' => '{{WRAPPER}} .aux-toggle-item:hover', |
| 286 | 'separator' => 'before' |
| 287 | ) |
| 288 | ); |
| 289 | |
| 290 | $this->add_group_control( |
| 291 | Group_Control_Border::get_type(), |
| 292 | array( |
| 293 | 'name' => 'item_container_border_hover', |
| 294 | 'selector' => '{{WRAPPER}} .aux-toggle-item:hover', |
| 295 | 'separator' => 'before' |
| 296 | ) |
| 297 | ); |
| 298 | |
| 299 | $this->end_controls_tab(); |
| 300 | |
| 301 | |
| 302 | $this->start_controls_tab( |
| 303 | 'item_container_status_active', |
| 304 | array( |
| 305 | 'label' => __( 'Selected' , 'auxin-elements' ) |
| 306 | ) |
| 307 | ); |
| 308 | |
| 309 | $this->add_group_control( |
| 310 | Group_Control_Box_Shadow::get_type(), |
| 311 | array( |
| 312 | 'name' => 'item_container_boxshadow_active', |
| 313 | 'label' => __( 'Box Shadow', 'auxin-elements' ), |
| 314 | 'selector' => '{{WRAPPER}} .active.aux-toggle-item', |
| 315 | 'separator' => 'none' |
| 316 | ) |
| 317 | ); |
| 318 | |
| 319 | $this->add_group_control( |
| 320 | Group_Control_Background::get_type(), |
| 321 | array( |
| 322 | 'name' => 'item_container_background_active', |
| 323 | 'selector' => '{{WRAPPER}} .active.aux-toggle-item', |
| 324 | 'separator' => 'before' |
| 325 | ) |
| 326 | ); |
| 327 | |
| 328 | $this->add_group_control( |
| 329 | Group_Control_Border::get_type(), |
| 330 | array( |
| 331 | 'name' => 'item_container_border_active', |
| 332 | 'selector' => '{{WRAPPER}} .active.aux-toggle-item', |
| 333 | 'separator' => 'before' |
| 334 | ) |
| 335 | ); |
| 336 | |
| 337 | $this->end_controls_tab(); |
| 338 | |
| 339 | $this->end_controls_tabs(); |
| 340 | |
| 341 | |
| 342 | $this->end_controls_section(); |
| 343 | |
| 344 | /* Title Bar Section |
| 345 | /*-------------------------------------*/ |
| 346 | |
| 347 | $this->start_controls_section( |
| 348 | 'title_bar_section', |
| 349 | array( |
| 350 | 'label' => __( 'Title Bar', 'auxin-elements' ), |
| 351 | 'tab' => Controls_Manager::TAB_STYLE |
| 352 | ) |
| 353 | ); |
| 354 | |
| 355 | $this->add_control( |
| 356 | 'title_bar_cursor', |
| 357 | array( |
| 358 | 'label' => __( 'Mouse Cursor', 'auxin-elements' ), |
| 359 | 'type' => Controls_Manager::SELECT, |
| 360 | 'options' => array( |
| 361 | 'default' => __( 'Default', 'auxin-elements' ), |
| 362 | 'pointer' => __( 'Pointer', 'auxin-elements' ), |
| 363 | 'zoom-in' => __( 'Zoom', 'auxin-elements' ), |
| 364 | 'help' => __( 'Help', 'auxin-elements' ) |
| 365 | ), |
| 366 | 'default' => 'pointer', |
| 367 | 'selectors' => array( |
| 368 | '{{WRAPPER}} .widget-inner > :not(.active) .aux-toggle-header' => 'cursor: {{VALUE}};' |
| 369 | ) |
| 370 | ) |
| 371 | ); |
| 372 | |
| 373 | $this->add_responsive_control( |
| 374 | 'title_bar_padding', |
| 375 | array( |
| 376 | 'label' => __( 'Padding', 'auxin-elements' ), |
| 377 | 'type' => Controls_Manager::DIMENSIONS, |
| 378 | 'size_units' => array( 'px', 'em', '%' ), |
| 379 | 'selectors' => array( |
| 380 | '{{WRAPPER}} .aux-toggle-header' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 381 | ) |
| 382 | ) |
| 383 | ); |
| 384 | |
| 385 | $this->add_responsive_control( |
| 386 | 'title_bar_margin', |
| 387 | array( |
| 388 | 'label' => __( 'Margin', 'auxin-elements' ), |
| 389 | 'type' => Controls_Manager::DIMENSIONS, |
| 390 | 'size_units' => array( 'px', 'em' ), |
| 391 | 'allowed_dimensions' => 'all', |
| 392 | 'selectors' => array( |
| 393 | '{{WRAPPER}} .aux-toggle-header' => 'margin:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 394 | ) |
| 395 | ) |
| 396 | ); |
| 397 | |
| 398 | $this->add_control( |
| 399 | 'title_bar_border_radius', |
| 400 | array( |
| 401 | 'label' => __( 'Border Radius', 'auxin-elements' ), |
| 402 | 'type' => Controls_Manager::DIMENSIONS, |
| 403 | 'size_units' => array( 'px', 'em', '%' ), |
| 404 | 'selectors' => array( |
| 405 | '{{WRAPPER}} .aux-toggle-header' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow:hidden;' |
| 406 | ), |
| 407 | 'allowed_dimensions' => 'all', |
| 408 | 'separator' => 'after' |
| 409 | ) |
| 410 | ); |
| 411 | |
| 412 | $this->start_controls_tabs( 'title_bar_status' ); |
| 413 | |
| 414 | $this->start_controls_tab( |
| 415 | 'title_bar_status_normal', |
| 416 | array( |
| 417 | 'label' => __( 'Normal' , 'auxin-elements' ) |
| 418 | ) |
| 419 | ); |
| 420 | |
| 421 | $this->add_group_control( |
| 422 | Group_Control_Box_Shadow::get_type(), |
| 423 | array( |
| 424 | 'name' => 'title_bar_boxshadow_normal', |
| 425 | 'label' => __( 'Box Shadow', 'auxin-elements' ), |
| 426 | 'selector' => '{{WRAPPER}} .aux-toggle-header', |
| 427 | 'separator' => 'none' |
| 428 | ) |
| 429 | ); |
| 430 | |
| 431 | $this->add_group_control( |
| 432 | Group_Control_Background::get_type(), |
| 433 | array( |
| 434 | 'name' => 'title_bar_background_normal', |
| 435 | 'selector' => '{{WRAPPER}} .aux-toggle-header', |
| 436 | 'separator' => 'before' |
| 437 | ) |
| 438 | ); |
| 439 | |
| 440 | $this->add_group_control( |
| 441 | Group_Control_Border::get_type(), |
| 442 | array( |
| 443 | 'name' => 'title_bar_border_normal', |
| 444 | 'selector' => '{{WRAPPER}} .aux-toggle-header', |
| 445 | 'separator' => 'before' |
| 446 | ) |
| 447 | ); |
| 448 | |
| 449 | $this->end_controls_tab(); |
| 450 | |
| 451 | |
| 452 | $this->start_controls_tab( |
| 453 | 'title_bar_status_hover', |
| 454 | array( |
| 455 | 'label' => __( 'Hover' , 'auxin-elements' ) |
| 456 | ) |
| 457 | ); |
| 458 | |
| 459 | $this->add_group_control( |
| 460 | Group_Control_Box_Shadow::get_type(), |
| 461 | array( |
| 462 | 'name' => 'title_bar_boxshadow_hover', |
| 463 | 'label' => __( 'Box Shadow', 'auxin-elements' ), |
| 464 | 'selector' => '{{WRAPPER}} .aux-toggle-header:hover', |
| 465 | 'separator' => 'none' |
| 466 | ) |
| 467 | ); |
| 468 | |
| 469 | $this->add_group_control( |
| 470 | Group_Control_Background::get_type(), |
| 471 | array( |
| 472 | 'name' => 'title_bar_background_hover', |
| 473 | 'selector' => '{{WRAPPER}} .aux-toggle-header:hover', |
| 474 | 'separator' => 'before' |
| 475 | ) |
| 476 | ); |
| 477 | |
| 478 | $this->add_group_control( |
| 479 | Group_Control_Border::get_type(), |
| 480 | array( |
| 481 | 'name' => 'title_bar_border_hover', |
| 482 | 'selector' => '{{WRAPPER}} .aux-toggle-header:hover', |
| 483 | 'separator' => 'before' |
| 484 | ) |
| 485 | ); |
| 486 | |
| 487 | $this->end_controls_tab(); |
| 488 | |
| 489 | |
| 490 | $this->start_controls_tab( |
| 491 | 'title_bar_status_active', |
| 492 | array( |
| 493 | 'label' => __( 'Selected' , 'auxin-elements' ) |
| 494 | ) |
| 495 | ); |
| 496 | |
| 497 | $this->add_group_control( |
| 498 | Group_Control_Box_Shadow::get_type(), |
| 499 | array( |
| 500 | 'name' => 'title_bar_boxshadow_active', |
| 501 | 'label' => __( 'Box Shadow', 'auxin-elements' ), |
| 502 | 'selector' => '{{WRAPPER}} .active .aux-toggle-header', |
| 503 | 'separator' => 'none' |
| 504 | ) |
| 505 | ); |
| 506 | |
| 507 | $this->add_group_control( |
| 508 | Group_Control_Background::get_type(), |
| 509 | array( |
| 510 | 'name' => 'title_bar_background_active', |
| 511 | 'selector' => '{{WRAPPER}} .active .aux-toggle-header', |
| 512 | 'separator' => 'before' |
| 513 | ) |
| 514 | ); |
| 515 | |
| 516 | $this->add_group_control( |
| 517 | Group_Control_Border::get_type(), |
| 518 | array( |
| 519 | 'name' => 'title_bar_border_active', |
| 520 | 'selector' => '{{WRAPPER}} .active .aux-toggle-header', |
| 521 | 'separator' => 'before' |
| 522 | ) |
| 523 | ); |
| 524 | |
| 525 | $this->end_controls_tab(); |
| 526 | |
| 527 | $this->end_controls_tabs(); |
| 528 | |
| 529 | |
| 530 | $this->end_controls_section(); |
| 531 | |
| 532 | |
| 533 | /* Title Style Section |
| 534 | /*-------------------------------------*/ |
| 535 | |
| 536 | $this->start_controls_section( |
| 537 | 'title_style_section', |
| 538 | array( |
| 539 | 'label' => __( 'Title', 'auxin-elements' ), |
| 540 | 'tab' => Controls_Manager::TAB_STYLE |
| 541 | ) |
| 542 | ); |
| 543 | |
| 544 | $this->start_controls_tabs( 'title_colors' ); |
| 545 | |
| 546 | $this->start_controls_tab( |
| 547 | 'title_color_normal', |
| 548 | array( |
| 549 | 'label' => __( 'Normal' , 'auxin-elements' ) |
| 550 | ) |
| 551 | ); |
| 552 | |
| 553 | $this->add_control( |
| 554 | 'title_color', |
| 555 | array( |
| 556 | 'label' => __( 'Color', 'auxin-elements' ), |
| 557 | 'type' => Controls_Manager::COLOR, |
| 558 | 'selectors' => array( |
| 559 | '{{WRAPPER}} .aux-toggle-header' => 'color: {{VALUE}};' |
| 560 | ) |
| 561 | ) |
| 562 | ); |
| 563 | |
| 564 | $this->end_controls_tab(); |
| 565 | |
| 566 | $this->start_controls_tab( |
| 567 | 'title_color_hover', |
| 568 | array( |
| 569 | 'label' => __( 'Hover' , 'auxin-elements' ) |
| 570 | ) |
| 571 | ); |
| 572 | |
| 573 | $this->add_control( |
| 574 | 'title_hover_color', |
| 575 | array( |
| 576 | 'label' => __( 'Color', 'auxin-elements' ), |
| 577 | 'type' => Controls_Manager::COLOR, |
| 578 | 'selectors' => array( |
| 579 | '{{WRAPPER}} .aux-toggle-header:hover' => 'color: {{VALUE}};', |
| 580 | ) |
| 581 | ) |
| 582 | ); |
| 583 | |
| 584 | $this->end_controls_tab(); |
| 585 | |
| 586 | $this->start_controls_tab( |
| 587 | 'title_color_selected', |
| 588 | array( |
| 589 | 'label' => __( 'Selected' , 'auxin-elements' ) |
| 590 | ) |
| 591 | ); |
| 592 | |
| 593 | $this->add_control( |
| 594 | 'title_selected_color', |
| 595 | array( |
| 596 | 'label' => __( 'Color', 'auxin-elements' ), |
| 597 | 'type' => Controls_Manager::COLOR, |
| 598 | 'selectors' => array( |
| 599 | '{{WRAPPER}} .active .aux-toggle-header' => 'color: {{VALUE}};', |
| 600 | ) |
| 601 | ) |
| 602 | ); |
| 603 | |
| 604 | $this->end_controls_tabs(); |
| 605 | |
| 606 | $this->add_group_control( |
| 607 | Group_Control_Typography::get_type(), |
| 608 | array( |
| 609 | 'name' => 'title_typography', |
| 610 | 'global' => [ |
| 611 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 612 | ], |
| 613 | 'selector' => '{{WRAPPER}} .aux-toggle-header' |
| 614 | ) |
| 615 | ); |
| 616 | |
| 617 | $this->end_controls_section(); |
| 618 | |
| 619 | /* Content Style Section |
| 620 | /*-------------------------------------*/ |
| 621 | |
| 622 | $this->start_controls_section( |
| 623 | 'content_style_section', |
| 624 | array( |
| 625 | 'label' => __( 'Content', 'auxin-elements' ), |
| 626 | 'tab' => Controls_Manager::TAB_STYLE |
| 627 | ) |
| 628 | ); |
| 629 | |
| 630 | $this->add_control( |
| 631 | 'content_color', |
| 632 | array( |
| 633 | 'label' => __( 'Color', 'auxin-elements' ), |
| 634 | 'type' => Controls_Manager::COLOR, |
| 635 | 'selectors' => array( |
| 636 | '{{WRAPPER}} .aux-toggle-content' => 'color: {{VALUE}}' |
| 637 | ) |
| 638 | ) |
| 639 | ); |
| 640 | |
| 641 | $this->add_group_control( |
| 642 | Group_Control_Typography::get_type(), |
| 643 | array( |
| 644 | 'name' => 'content_typography', |
| 645 | 'global' => [ |
| 646 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 647 | ], |
| 648 | 'selector' => '{{WRAPPER}} .aux-toggle-content' |
| 649 | ) |
| 650 | ); |
| 651 | |
| 652 | $this->add_responsive_control( |
| 653 | 'content_padding', |
| 654 | array( |
| 655 | 'label' => __( 'Padding', 'auxin-elements' ), |
| 656 | 'type' => Controls_Manager::DIMENSIONS, |
| 657 | 'size_units' => array( 'px', 'em', '%' ), |
| 658 | 'separator' => 'before', |
| 659 | 'selectors' => array( |
| 660 | '{{WRAPPER}} .aux-toggle-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 661 | ) |
| 662 | ) |
| 663 | ); |
| 664 | |
| 665 | $this->add_responsive_control( |
| 666 | 'content_margin', |
| 667 | array( |
| 668 | 'label' => __( 'Margin', 'auxin-elements' ), |
| 669 | 'type' => Controls_Manager::DIMENSIONS, |
| 670 | 'size_units' => array( 'px', 'em' ), |
| 671 | 'allowed_dimensions' => 'all', |
| 672 | 'selectors' => array( |
| 673 | '{{WRAPPER}} .aux-toggle-content' => 'margin:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 674 | ) |
| 675 | ) |
| 676 | ); |
| 677 | |
| 678 | $this->add_control( |
| 679 | 'content_border_radius', |
| 680 | array( |
| 681 | 'label' => __( 'Border Radius', 'auxin-elements' ), |
| 682 | 'type' => Controls_Manager::DIMENSIONS, |
| 683 | 'size_units' => array( 'px', 'em', '%' ), |
| 684 | 'selectors' => array( |
| 685 | '{{WRAPPER}} .aux-toggle-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow:hidden;' |
| 686 | ), |
| 687 | 'allowed_dimensions' => 'all', |
| 688 | 'separator' => 'before' |
| 689 | ) |
| 690 | ); |
| 691 | |
| 692 | $this->add_group_control( |
| 693 | Group_Control_Box_Shadow::get_type(), |
| 694 | array( |
| 695 | 'name' => 'content_shadow', |
| 696 | 'selector' => '{{WRAPPER}} .aux-toggle-content', |
| 697 | 'separator' => 'none' |
| 698 | ) |
| 699 | ); |
| 700 | |
| 701 | $this->add_group_control( |
| 702 | Group_Control_Background::get_type(), |
| 703 | array( |
| 704 | 'name' => 'content_background', |
| 705 | 'selector' => '{{WRAPPER}} .aux-toggle-content', |
| 706 | 'separator' => 'before' |
| 707 | ) |
| 708 | ); |
| 709 | |
| 710 | $this->add_group_control( |
| 711 | Group_Control_Border::get_type(), |
| 712 | array( |
| 713 | 'name' => 'content_border', |
| 714 | 'selector' => '{{WRAPPER}} .aux-toggle-content', |
| 715 | 'separator' => 'before' |
| 716 | ) |
| 717 | ); |
| 718 | |
| 719 | $this->end_controls_section(); |
| 720 | } |
| 721 | |
| 722 | /** |
| 723 | * Render 'Accordion' widget output on the frontend. |
| 724 | * |
| 725 | * Written in PHP and used to generate the final HTML. |
| 726 | * |
| 727 | * @since 1.0.0 |
| 728 | * @access protected |
| 729 | */ |
| 730 | protected function render() { |
| 731 | |
| 732 | $settings = $this->get_settings_for_display(); |
| 733 | |
| 734 | $args = array( |
| 735 | 'type' => $settings['type'], |
| 736 | 'accordion' => $settings['tab_items'], |
| 737 | 'title_tag' => $settings['title_tag'], |
| 738 | 'tab_id_prefix'=> substr( $this->get_id_int(), 0, 3 ) |
| 739 | ); |
| 740 | |
| 741 | // pass the args through the corresponding shortcode callback |
| 742 | echo auxin_widget_accordion_callback( $args ); |
| 743 | } |
| 744 | |
| 745 | /** |
| 746 | * Render accordion element in the editor. |
| 747 | * |
| 748 | * @access protected |
| 749 | */ |
| 750 | protected function content_template() { |
| 751 | ?> |
| 752 | <# |
| 753 | var typeClass = settings.type == 'true' ? 'aux-type-toggle' : 'aux-type-accordion'; |
| 754 | view.addRenderAttribute( |
| 755 | 'widgetInner', |
| 756 | { |
| 757 | 'class': [ 'widget-inner', typeClass ], |
| 758 | 'data-toggle': settings.type |
| 759 | } |
| 760 | ); |
| 761 | #> |
| 762 | <section class="widget-container aux-widget-accordion widget-toggle"> |
| 763 | <div {{{ view.getRenderAttributeString('widgetInner') }}}> |
| 764 | <# |
| 765 | if ( settings.tab_items ) { |
| 766 | var tabindex = view.getIDInt().toString().substr( 0, 3 ); |
| 767 | |
| 768 | _.each( settings.tab_items, function( item, index ) { |
| 769 | var tabLabelKey = view.getRepeaterSettingKey( 'accordion_label', 'tab_items', index ), |
| 770 | tabContentKey = view.getRepeaterSettingKey( 'content', 'tab_items', index ), |
| 771 | IdNumber = tabindex + index + 1; |
| 772 | |
| 773 | view.addRenderAttribute( tabLabelKey, { |
| 774 | 'id': 'aux-toggle-header-' + IdNumber, |
| 775 | 'class': [ 'aux-toggle-header', 'toggle-header' ], |
| 776 | 'tabindex': IdNumber, |
| 777 | 'role': 'tab', |
| 778 | 'aria-controls': 'aux-toggle-content-' + IdNumber |
| 779 | } ); |
| 780 | |
| 781 | view.addRenderAttribute( tabContentKey, { |
| 782 | 'id': 'aux-toggle-content-' + IdNumber, |
| 783 | 'class': [ 'aux-toggle-content', 'toggle-content' ], |
| 784 | 'role': 'tabpanel', |
| 785 | 'aria-labelledby': 'aux-toggle-header-' + IdNumber |
| 786 | } ); |
| 787 | |
| 788 | view.addInlineEditingAttributes( tabContentKey, 'advanced' ); |
| 789 | #> |
| 790 | <section> |
| 791 | <{{{ settings.title_tag }}} {{{ view.getRenderAttributeString( tabLabelKey ) }}}> |
| 792 | {{{ item.accordion_label }}} |
| 793 | </{{{ settings.title_tag }}}> |
| 794 | <div {{{ view.getRenderAttributeString( tabContentKey ) }}}> |
| 795 | <p>{{{ item.content }}}</p> |
| 796 | </div> |
| 797 | </section> |
| 798 | <# |
| 799 | }); |
| 800 | } #> |
| 801 | </div> |
| 802 | </section> |
| 803 | <?php |
| 804 | } |
| 805 | |
| 806 | } |
| 807 |