startControlsSection( 'section_toggle', [ 'label' => __('Toggle'), ] ); $repeater = new Repeater(); $repeater->addControl( 'tab_title', [ 'label' => __('Title & Description'), 'type' => ControlsManager::TEXT, 'default' => __('Toggle Title'), 'label_block' => true, ] ); $repeater->addControl( 'tab_content', [ 'label' => __('Content'), 'type' => ControlsManager::WYSIWYG, 'default' => __('Toggle Content'), 'show_label' => false, ] ); $this->addControl( 'tabs', [ 'label' => __('Toggle Items'), 'type' => ControlsManager::REPEATER, 'fields' => $repeater->getControls(), 'default' => [ [ 'tab_title' => __('Toggle #1'), 'tab_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.'), ], [ 'tab_title' => __('Toggle #2'), 'tab_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.'), ], ], 'title_field' => '{{{ tab_title }}}', ] ); $this->addControl( 'view', [ 'label' => __('View'), 'type' => ControlsManager::HIDDEN, 'default' => 'traditional', ] ); $this->addControl( 'icon', [ 'label' => __('Icon'), 'type' => ControlsManager::ICON, 'default' => is_rtl() ? 'fa fa-caret-left' : 'fa fa-caret-right', 'separator' => 'before', ] ); $this->addControl( 'icon_active', [ 'label' => __('Active Icon'), 'type' => ControlsManager::ICON, 'default' => 'fa fa-caret-up', 'condition' => [ 'icon!' => '', ], ] ); $this->addControl( 'title_html_tag', [ 'label' => __('Title HTML Tag'), 'type' => ControlsManager::SELECT, 'options' => [ 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6', 'div' => 'div', ], 'default' => 'div', 'separator' => 'before', ] ); $this->endControlsSection(); $this->startControlsSection( 'section_toggle_style', [ 'label' => __('Toggle'), 'tab' => ControlsManager::TAB_STYLE, ] ); $this->addControl( 'border_width', [ 'label' => __('Border Width'), 'type' => ControlsManager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 10, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-tab-title' => 'border-width: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .elementor-tab-content' => 'border-width: {{SIZE}}{{UNIT}};', ], ] ); $this->addControl( 'border_color', [ 'label' => __('Border Color'), 'type' => ControlsManager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-tab-content' => 'border-bottom-color: {{VALUE}};', '{{WRAPPER}} .elementor-tab-title' => 'border-color: {{VALUE}};', ], ] ); $this->addResponsiveControl( 'space_between', [ 'label' => __('Space Between'), 'type' => ControlsManager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-toggle-item:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}}', ], ] ); $this->addGroupControl( GroupControlBoxShadow::getType(), [ 'name' => 'box_shadow', 'selector' => '{{WRAPPER}} .elementor-toggle-item', ] ); $this->endControlsSection(); $this->startControlsSection( 'section_toggle_style_title', [ 'label' => __('Title'), 'tab' => ControlsManager::TAB_STYLE, ] ); $this->addControl( 'title_background', [ 'label' => __('Background'), 'type' => ControlsManager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-tab-title' => 'background-color: {{VALUE}};', ], ] ); $this->addControl( 'title_color', [ 'label' => __('Color'), 'type' => ControlsManager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-tab-title' => 'color: {{VALUE}};', ], 'scheme' => [ 'type' => SchemeColor::getType(), 'value' => SchemeColor::COLOR_1, ], ] ); $this->addControl( 'tab_active_color', [ 'label' => __('Active Color'), 'type' => ControlsManager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-tab-title.elementor-active' => 'color: {{VALUE}};', ], 'scheme' => [ 'type' => SchemeColor::getType(), 'value' => SchemeColor::COLOR_4, ], ] ); $this->addGroupControl( GroupControlTypography::getType(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .elementor-tab-title', 'scheme' => SchemeTypography::TYPOGRAPHY_1, ] ); $this->addGroupControl( GroupControlTextStroke::getType(), [ 'name' => 'text_stroke', 'selector' => '{{WRAPPER}} .elementor-tab-title', ] ); $this->addGroupControl( GroupControlTextShadow::getType(), [ 'name' => 'title_shadow', 'selector' => '{{WRAPPER}} .elementor-tab-title', ] ); $this->addResponsiveControl( 'title_padding', [ 'label' => __('Padding'), 'type' => ControlsManager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .elementor-tab-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->endControlsSection(); $this->startControlsSection( 'section_toggle_style_icon', [ 'label' => __('Icon'), 'tab' => ControlsManager::TAB_STYLE, 'condition' => [ 'icon!' => '', ], ] ); $this->addControl( 'icon_align', [ 'label' => __('Alignment'), 'type' => ControlsManager::CHOOSE, 'options' => [ 'left' => [ 'title' => __('Start'), 'icon' => 'eicon-h-align-left', ], 'right' => [ 'title' => __('End'), 'icon' => 'eicon-h-align-right', ], ], 'default' => is_rtl() ? 'right' : 'left', 'toggle' => false, 'label_block' => false, 'condition' => [ 'icon!' => '', ], ] ); $this->addControl( 'icon_color', [ 'label' => __('Color'), 'type' => ControlsManager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-tab-title .elementor-toggle-icon .fa:before' => 'color: {{VALUE}};', ], 'condition' => [ 'icon!' => '', ], ] ); $this->addControl( 'icon_active_color', [ 'label' => __('Active Color'), 'type' => ControlsManager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-tab-title.elementor-active .elementor-toggle-icon .fa:before' => 'color: {{VALUE}};', ], 'condition' => [ 'icon!' => '', ], ] ); $this->addResponsiveControl( 'icon_space', [ 'label' => __('Spacing'), 'type' => ControlsManager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-toggle-icon.elementor-toggle-icon-left' => 'margin-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .elementor-toggle-icon.elementor-toggle-icon-right' => 'margin-left: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'icon!' => '', ], ] ); $this->endControlsSection(); $this->startControlsSection( 'section_toggle_style_content', [ 'label' => __('Content'), 'tab' => ControlsManager::TAB_STYLE, ] ); $this->addControl( 'content_background_color', [ 'label' => __('Background'), 'type' => ControlsManager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-tab-content' => 'background-color: {{VALUE}};', ], ] ); $this->addControl( 'content_color', [ 'label' => __('Color'), 'type' => ControlsManager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-tab-content' => 'color: {{VALUE}};', ], 'scheme' => [ 'type' => SchemeColor::getType(), 'value' => SchemeColor::COLOR_3, ], ] ); $this->addGroupControl( GroupControlTypography::getType(), [ 'name' => 'content_typography', 'selector' => '{{WRAPPER}} .elementor-tab-content', 'scheme' => SchemeTypography::TYPOGRAPHY_3, ] ); $this->addGroupControl( GroupControlTextShadow::getType(), [ 'name' => 'content_shadow', 'selector' => '{{WRAPPER}} .elementor-tab-content', ] ); $this->addResponsiveControl( 'content_padding', [ 'label' => __('Padding'), 'type' => ControlsManager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .elementor-tab-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->endControlsSection(); } /** * Render toggle 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->getSettingsForDisplay(); $id_int = \Tools::substr($this->getIdInt(), 0, 3); empty($settings['icon']) or $this->addRenderAttribute('toggle_icon', [ 'class' => 'elementor-toggle-icon elementor-toggle-icon-' . $settings['icon_align'], 'aria-hidden' => 'true', ]); ?>