File manager - Edit - /home/boiitech111/autorollingright.com/wp-content/themes/carutos/inc/vendor/elementor/widgets/tabs.php
Back
<?php if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } use Elementor\Controls_Manager; use Elementor\Group_Control_Typography; use Elementor\Repeater; /** * Elementor tabs widget. * * Elementor widget that displays vertical or horizontal tabs with different * pieces of content. * * @since 1.0.0 */ class WPOPAL_Elementor_Tabs_Widget extends Elementor\Widget_Base{ public function get_categories() { return array('opal-addons'); } /** * Get widget name. * * Retrieve tabs widget name. * * @since 1.0.0 * @access public * * @return string Widget name. */ public function get_name() { return 'opal-tabs'; } /** * Get widget title. * * Retrieve tabs widget title. * * @since 1.0.0 * @access public * * @return string Widget title. */ public function get_title() { return esc_html__( 'Opal Tabs', 'carutos'); } /** * Get widget icon. * * Retrieve tabs widget icon. * * @since 1.0.0 * @access public * * @return string Widget icon. */ public function get_icon() { return 'eicon-tabs'; } /** * Register tabs widget controls. * * Adds different input fields to allow the user to change and customize the widget settings. * * @since 1.0.0 * @access protected */ protected function register_controls() { $templates = Elementor\Plugin::instance()->templates_manager->get_source( 'local' )->get_items(); $options = [ '0' => '— ' . esc_html__( 'Select', 'carutos') . ' —', ]; $types = []; foreach ( $templates as $template ) { $options[ $template['template_id'] ] = $template['title'] . ' (' . $template['type'] . ')'; $types[ $template['template_id'] ] = $template['type']; } $this->start_controls_section( 'section_tabs', [ 'label' => esc_html__( 'Tabs', 'carutos'), ] ); $repeater = new Repeater(); $repeater->add_control( 'tab_title', [ 'label' => esc_html__( 'Title & Content', 'carutos'), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Tab Title', 'carutos'), 'placeholder' => esc_html__( 'Tab Title', 'carutos'), 'label_block' => true, ] ); $repeater->add_control( 'source', [ 'label' => esc_html__( 'Source', 'carutos'), 'type' => Controls_Manager::SELECT, 'default' => 'html', 'options' => [ 'html' => esc_html__( 'HTML', 'carutos'), 'template' => esc_html__( 'Template', 'carutos'), ], ] ); $repeater->add_control( 'tab_html', [ 'label' => esc_html__( 'Content', 'carutos'), 'default' => esc_html__( 'Tab Content', 'carutos'), 'placeholder' => esc_html__( 'Tab Content', 'carutos'), 'type' => Controls_Manager::WYSIWYG, 'show_label' => false, 'condition' => [ 'source' => 'html', ], ] ); $repeater->add_control( 'tab_template', [ 'label' => esc_html__( 'Choose Template', 'carutos'), 'default' => 0, 'type' => Controls_Manager::SELECT, 'options' => $options, 'types' => $types, 'label_block' => 'true', 'condition' => [ 'source' => 'template', ], ] ); $this->add_control( 'tabs', [ 'label' => esc_html__( 'Tabs Items', 'carutos'), 'type' => Controls_Manager::REPEATER, 'fields' => $repeater->get_controls(), 'default' => [ [ 'tab_title' => esc_html__( 'Tab #1', 'carutos'), 'source' => 'html', 'tab_html' => esc_html__( 'I am 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.', 'carutos'), ], [ 'tab_title' => esc_html__( 'Tab #2', 'carutos'), 'source' => 'html', 'tab_html' => esc_html__( 'I am 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.', 'carutos'), ], ], 'title_field' => '{{{ tab_title }}}', ] ); $this->add_control( 'view', [ 'label' => esc_html__( 'View', 'carutos'), 'type' => Controls_Manager::HIDDEN, 'default' => 'traditional', ] ); $this->add_control( 'type', [ 'label' => esc_html__( 'Type', 'carutos'), 'type' => Controls_Manager::SELECT, 'default' => 'horizontal', 'options' => [ 'horizontal' => esc_html__( 'Horizontal', 'carutos'), 'vertical' => esc_html__( 'Vertical', 'carutos'), ], 'prefix_class' => 'elementor-tabs-view-', 'separator' => 'before', ] ); $this->add_control( 'align_items', [ 'label' => esc_html__('Align', 'carutos'), 'type' => Controls_Manager::CHOOSE, 'label_block' => false, 'options' => [ 'left' => [ 'title' => esc_html__('Left', 'carutos'), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => esc_html__('Center', 'carutos'), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => esc_html__('Right', 'carutos'), 'icon' => 'eicon-h-align-right', ], ], 'default' => 'left', 'prefix_class' => 'opal-tab-title-align-', 'condition' => [ 'type' => 'horizontal', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_tabs_style', [ 'label' => esc_html__( 'Tabs', 'carutos'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'navigation_width', [ 'label' => esc_html__( 'Navigation Width', 'carutos'), 'type' => Controls_Manager::SLIDER, 'default' => [ 'unit' => '%', ], 'range' => [ '%' => [ 'min' => 10, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-tabs-wrapper' => 'width: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'type' => 'vertical', ], ] ); $this->add_control( 'border_width', [ 'label' => esc_html__( 'Border Width', 'carutos'), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 10, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-tab-content, {{WRAPPER}} .elementor-tabs-content-wrapper' => 'border-width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'border_color', [ 'label' => esc_html__( 'Border Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-tab-content, {{WRAPPER}} .elementor-tabs-content-wrapper' => 'border-color: {{VALUE}};', ], ] ); $this->add_control( 'heading_title', [ 'label' => esc_html__( 'Title', 'carutos'), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'tab_color', [ 'label' => esc_html__( 'Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-tab-title' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'tab_active_color', [ 'label' => esc_html__( 'Active Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-tab-title.elementor-active' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'text_padding', [ 'label' => esc_html__( 'Padding', 'carutos'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .elementor-tab-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'text_margin', [ 'label' => esc_html__( 'Margin', 'carutos'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .elementor-tab-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'text_width', [ 'label' => esc_html__( 'Width', 'carutos'), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 300, ], ], 'devices' => [ 'desktop', 'tablet', 'mobile' ], 'selectors' => [ '{{WRAPPER}} .elementor-tab-title' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'background_color', [ 'label' => esc_html__( 'Background Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-tab-desktop-title' => 'background-color: {{VALUE}};' ], ] ); $this->add_control( 'background_color_active', [ 'label' => esc_html__( 'Background Color Active', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-tab-desktop-title.elementor-active' => 'background-color: {{VALUE}};' ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'tab_typography', 'selector' => '{{WRAPPER}} .elementor-tab-title', ] ); $this->add_control( 'heading_content', [ 'label' => esc_html__( 'Content', 'carutos'), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'content_color', [ 'label' => esc_html__( 'Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-tab-content' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'content_background', [ 'label' => esc_html__( 'Background Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-tabs-content-wrapper' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'margin', [ 'label' => esc_html__( 'Margin', 'carutos'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .elementor-tab-content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'padding', [ 'label' => esc_html__( 'Padding', 'carutos'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .elementor-tab-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'content_typography', 'selector' => '{{WRAPPER}} .elementor-tab-content', ] ); $this->end_controls_section(); } /** * Render tabs widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { $tabs = $this->get_settings_for_display( 'tabs' ); $id_int = substr( $this->get_id_int(), 0, 3 ); ?> <div class="elementor-tabs" role="tablist"> <div class="elementor-tabs-wrapper"> <?php foreach ( $tabs as $index => $item ) : $tab_count = $index + 1; $class = ($index == 0)? 'elementor-active' : ''; $tab_title_setting_key = $this->get_repeater_setting_key( 'tab_title', 'tabs', $index ); $this->add_render_attribute( $tab_title_setting_key, [ 'id' => 'elementor-tab-title-' . $id_int . $tab_count, 'class' => [ 'elementor-tab-title', 'elementor-tab-desktop-title', $class], 'data-tab' => $tab_count, 'tabindex' => $id_int . $tab_count, 'role' => 'tab', 'aria-controls' => 'elementor-tab-content-' . $id_int . $tab_count, ] ); ?> <div <?php echo wp_kses_post( $this->get_render_attribute_string( $tab_title_setting_key ) ); // WPCS: XSS ok. ?>> <?php echo esc_html($item['tab_title']); ?> </div> <?php endforeach; ?> </div> <div class="elementor-tabs-content-wrapper"> <?php foreach ( $tabs as $index => $item ) : $tab_count = $index + 1; $class_content = ($index == 0)? 'elementor-active' : ''; $tab_content_setting_key = $this->get_repeater_setting_key( 'tab_content', 'tabs', $index ); $this->add_render_attribute( $tab_content_setting_key, [ 'id' => 'elementor-tab-content-' . $id_int . $tab_count, 'class' => [ 'elementor-tab-content', 'elementor-clearfix', $class_content], 'data-tab' => $tab_count, 'role' => 'tabpanel', 'aria-labelledby' => 'elementor-tab-title-' . $id_int . $tab_count, ] ); $this->add_inline_editing_attributes( $tab_content_setting_key, 'advanced' ); ?> <div <?php echo wp_kses_post( $this->get_render_attribute_string( $tab_content_setting_key ) ); // WPCS: XSS ok.?>> <?php if('html' === $item['source']): ?> <?php echo do_shortcode( $item['tab_html']); ?> <?php else: ?> <?php echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $item['tab_template'] ); // WPCS: XSS ok.?> <?php endif; ?> </div> <?php endforeach; ?> </div> </div> <?php } } $widgets_manager->register(new WPOPAL_Elementor_Tabs_Widget());
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.06 |
proxy
|
phpinfo
|
Settings