start_controls_section( 'section_title', [ 'label' => __( 'Accordion', 'elementor' ), ] ); $this->add_control( 'tabs', [ 'label' => __( 'Accordion Items', 'elementor' ), 'type' => Controls_Manager::REPEATER, 'default' => [ [ 'tab_title' => __( 'Accordion #1', 'elementor' ), 'tab_content' => __( 'I am item 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.', 'elementor' ), ], [ 'tab_title' => __( 'Accordion #2', 'elementor' ), 'tab_content' => __( 'I am item 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.', 'elementor' ), ], ], 'fields' => [ [ 'name' => 'tab_title', 'label' => __( 'Title & Content', 'elementor' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Accordion Title' , 'elementor' ), 'label_block' => true, ], [ 'name' => 'tab_content', 'label' => __( 'Content', 'elementor' ), 'type' => Controls_Manager::WYSIWYG, 'default' => __( 'Accordion Content', 'elementor' ), 'show_label' => false, ], ], 'title_field' => '{{{ tab_title }}}', ] ); $this->add_control( 'view', [ 'label' => __( 'View', 'elementor' ), 'type' => Controls_Manager::HIDDEN, 'default' => 'traditional', ] ); $this->add_control( 'title_html_tag', [ 'label' => __( 'Title HTML Tag', 'elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6', 'div' => 'div', ], 'default' => 'div', 'separator' => 'before', ] ); $this->add_control( 'icon', [ 'label' => __( 'Icon', 'elementor' ), 'type' => Controls_Manager::ICON, 'default' => 'fa fa-plus', 'label_block' => true, ] ); $this->add_control( 'icon_active', [ 'label' => __( 'Active Icon', 'elementor' ), 'type' => Controls_Manager::ICON, 'default' => 'fa fa-minus', 'label_block' => true, 'condition' => [ 'icon!' => '', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_title_style', [ 'label' => __( 'Accordion', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'border_width', [ 'label' => __( 'Border Width', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 10, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-accordion-item' => 'border-width: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .elementor-accordion .elementor-accordion-item .elementor-tab-content' => 'border-width: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .elementor-accordion .elementor-accordion-item .elementor-tab-title.elementor-active' => 'border-width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'border_color', [ 'label' => __( 'Border Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-accordion-item' => 'border-color: {{VALUE}};', '{{WRAPPER}} .elementor-accordion .elementor-accordion-item .elementor-tab-content' => 'border-top-color: {{VALUE}};', '{{WRAPPER}} .elementor-accordion .elementor-accordion-item .elementor-tab-title.elementor-active' => 'border-bottom-color: {{VALUE}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_toggle_style_title', [ 'label' => __( 'Title', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'title_background', [ 'label' => __( 'Background', 'elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-tab-title' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'title_color', [ 'label' => __( 'Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-tab-title' => 'color: {{VALUE}};', ], 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_1, ], ] ); $this->add_control( 'tab_active_color', [ 'label' => __( 'Active Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-tab-title.elementor-active' => 'color: {{VALUE}};', ], 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_4, ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .elementor-accordion .elementor-tab-title', 'scheme' => Scheme_Typography::TYPOGRAPHY_1, ] ); $this->add_responsive_control( 'title_padding', [ 'label' => __( 'Padding', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-tab-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_toggle_style_icon', [ 'label' => __( 'Icon', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'icon!' => '', ], ] ); $this->add_control( 'icon_align', [ 'label' => __( 'Alignment', 'elementor' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Start', 'elementor' ), 'icon' => 'eicon-h-align-left', ], 'right' => [ 'title' => __( 'End', 'elementor' ), 'icon' => 'eicon-h-align-right', ], ], 'default' => is_rtl() ? 'right' : 'left', 'toggle' => false, 'label_block' => false, 'condition' => [ 'icon!' => '', ], ] ); $this->add_control( 'icon_color', [ 'label' => __( 'Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-tab-title .elementor-accordion-icon .fa:before' => 'color: {{VALUE}};', ], 'condition' => [ 'icon!' => '', ], ] ); $this->add_control( 'icon_active_color', [ 'label' => __( 'Active Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-tab-title.elementor-active .elementor-accordion-icon .fa:before' => 'color: {{VALUE}};', ], 'condition' => [ 'icon!' => '', ], ] ); $this->add_responsive_control( 'icon_space', [ 'label' => __( 'Spacing', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-accordion-icon.elementor-accordion-icon-left' => 'margin-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .elementor-accordion .elementor-accordion-icon.elementor-accordion-icon-right' => 'margin-left: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'icon!' => '', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_toggle_style_content', [ 'label' => __( 'Content', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'icon!' => '', ], ] ); $this->add_control( 'content_background_color', [ 'label' => __( 'Background', 'elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-tab-content' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'content_color', [ 'label' => __( 'Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-tab-content' => 'color: {{VALUE}};', ], 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_3, ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'content_typography', 'selector' => '{{WRAPPER}} .elementor-accordion .elementor-tab-content', 'scheme' => Scheme_Typography::TYPOGRAPHY_3, ] ); $this->add_responsive_control( 'content_padding', [ 'label' => __( 'Padding', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .elementor-accordion .elementor-tab-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); } /** * Render accordion widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->get_settings(); $id_int = substr( $this->get_id_int(), 0, 3 ); ?>