Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
pokeloken
/
admin
/
wp-content
/
plugins
/
bdevs-element
/
widgets
/
time
:
time-widget.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php namespace BdevsElement\Widget; use \Elementor\Group_Control_Background; use \Elementor\Repeater; use \Elementor\Controls_Manager; use \Elementor\Group_Control_Border; use \Elementor\Group_Control_Image_Size; use \Elementor\Group_Control_Typography; Use \Elementor\Core\Schemes\Typography; use \Elementor\Utils; defined( 'ABSPATH' ) || die(); class Time extends BDevs_El_Widget { /** * Get widget name. * * Retrieve Bdevs Element widget name. * * @since 1.0.0 * @access public * * @return string Widget name. */ public function get_name() { return 'time'; } /** * Get widget title. * * @since 1.0.0 * @access public * * @return string Widget title. */ public function get_title() { return __( 'Time', 'bdevselement' ); } public function get_custom_help_url() { return 'http://elementor.bdevs.net//widgets/fact/'; } /** * Get widget icon. * * @since 1.0.0 * @access public * * @return string Widget icon. */ public function get_icon() { return 'eicon-meta-data'; } public function get_keywords() { return [ 'schedule', 'counter' ]; } protected function register_content_controls() { $this->start_controls_section( '_section_slides', [ 'label' => __( 'Time schedule', 'bdevselement' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $repeater = new Repeater(); $repeater->add_control( 'icon', [ 'type' => Controls_Manager::TEXT, 'label_block' => true, 'label' => __( 'Icon Name', 'bdevselement' ), 'default' => __( 'fal fa-arrow-down', 'bdevselement' ), 'placeholder' => __( 'Type title here', 'bdevselement' ), 'dynamic' => [ 'active' => true, ] ] ); $repeater->add_control( 'title', [ 'type' => Controls_Manager::TEXT, 'label_block' => true, 'label' => __( 'Title', 'bdevselement' ), 'placeholder' => __( 'Type title here', 'bdevselement' ), 'dynamic' => [ 'active' => true, ] ] ); $repeater->add_control( 'description', [ 'type' => Controls_Manager::TEXTAREA, 'label_block' => true, 'show_label' => false, 'label' => __( 'Description', 'bdevselement' ), 'placeholder' => __( 'Type description here', 'bdevselement' ), 'dynamic' => [ 'active' => true, ] ] ); $this->add_control( 'slides', [ 'show_label' => false, 'type' => Controls_Manager::REPEATER, 'fields' => $repeater->get_controls(), 'title_field' => '<# print(title || "Carousel Item"); #>', 'default' => [ [ 'image' => [ 'url' => Utils::get_placeholder_image_src(), ], ], [ 'image' => [ 'url' => Utils::get_placeholder_image_src(), ], ], ] ] ); $this->end_controls_section(); $this->start_controls_section( '_section_button', [ 'label' => __( 'Button', 'bdevselement' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'button_text', [ 'label' => __( 'Text', 'bdevselement' ), 'type' => Controls_Manager::TEXT, 'default' => 'Button Text', 'placeholder' => __( 'Type button text here', 'bdevselement' ), 'label_block' => true, 'dynamic' => [ 'active' => true, ] ] ); $this->add_control( 'button_link', [ 'label' => __( 'Link', 'bdevselement' ), 'type' => Controls_Manager::URL, 'placeholder' => 'http://elementor.bdevs.net/', 'dynamic' => [ 'active' => true, ] ] ); if ( bdevs_element_is_elementor_version( '<', '2.6.0' ) ) { $this->add_control( 'button_icon', [ 'label' => __( 'Icon', 'bdevselement' ), 'label_block' => true, 'type' => Controls_Manager::ICON, 'options' => bdevs_element_get_bdevs_element_icons(), 'default' => 'fa fa-angle-right', ] ); $condition = ['button_icon!' => '']; } else { $this->add_control( 'button_selected_icon', [ 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'button_icon', 'label_block' => true, ] ); $condition = ['button_selected_icon[value]!' => '']; } $this->add_control( 'button_icon_position', [ 'label' => __( 'Icon Position', 'bdevselement' ), 'type' => Controls_Manager::CHOOSE, 'label_block' => false, 'options' => [ 'before' => [ 'title' => __( 'Before', 'bdevselement' ), 'icon' => 'eicon-h-align-left', ], 'after' => [ 'title' => __( 'After', 'bdevselement' ), 'icon' => 'eicon-h-align-right', ], ], 'default' => 'before', 'toggle' => false, 'condition' => $condition, 'style_transfer' => true, ] ); $this->add_control( 'button_icon_spacing', [ 'label' => __( 'Icon Spacing', 'bdevselement' ), 'type' => Controls_Manager::SLIDER, 'condition' => $condition, 'selectors' => [ '{{WRAPPER}} .bdevs-btn--icon-before .bdevs-btn-icon' => 'margin-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .bdevs-btn--icon-after .bdevs-btn-icon' => 'margin-left: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); } protected function register_style_controls() { $this->start_controls_section( '_section_style_item', [ 'label' => __( 'Slider Item', 'bdevselement' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'item_border', 'selector' => '{{WRAPPER}} .bdevs-slick-item', ] ); $this->add_responsive_control( 'item_border_radius', [ 'label' => __( 'Border Radius', 'bdevselement' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .bdevs-slick-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;', ], ] ); $this->end_controls_section(); $this->start_controls_section( '_section_style_content', [ 'label' => __( 'Slide Content', 'bdevselement' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'content_padding', [ 'label' => __( 'Content Padding', 'bdevselement' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .bdevs-slick-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'content_background', 'selector' => '{{WRAPPER}} .bdevs-slick-content', 'exclude' => [ 'image' ] ] ); $this->add_control( '_heading_title', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Title', 'bdevselement' ), 'separator' => 'before' ] ); $this->add_responsive_control( 'title_spacing', [ 'label' => __( 'Bottom Spacing', 'bdevselement' ), 'type' => Controls_Manager::SLIDER, 'size_units' => ['px'], 'selectors' => [ '{{WRAPPER}} .bdevs-slick-title' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'title_color', [ 'label' => __( 'Text Color', 'bdevselement' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .bdevs-slick-title' => 'color: {{VALUE}}', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title', 'selector' => '{{WRAPPER}} .bdevs-slick-title', 'scheme' => Typography::TYPOGRAPHY_2, ] ); $this->add_control( '_heading_subtitle', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Subtitle', 'bdevselement' ), 'separator' => 'before' ] ); $this->add_responsive_control( 'subtitle_spacing', [ 'label' => __( 'Bottom Spacing', 'bdevselement' ), 'type' => Controls_Manager::SLIDER, 'size_units' => ['px'], 'selectors' => [ '{{WRAPPER}} .bdevs-slick-subtitle' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'subtitle_color', [ 'label' => __( 'Text Color', 'bdevselement' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .bdevs-slick-subtitle' => 'color: {{VALUE}}', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'subtitle', 'selector' => '{{WRAPPER}} .bdevs-slick-subtitle', 'scheme' => Typography::TYPOGRAPHY_3, ] ); $this->end_controls_section(); $this->start_controls_section( '_section_style_arrow', [ 'label' => __( 'Navigation - Arrow', 'bdevselement' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'arrow_position_toggle', [ 'label' => __( 'Position', 'bdevselement' ), 'type' => Controls_Manager::POPOVER_TOGGLE, 'label_off' => __( 'None', 'bdevselement' ), 'label_on' => __( 'Custom', 'bdevselement' ), 'return_value' => 'yes', ] ); $this->start_popover(); $this->add_responsive_control( 'arrow_position_y', [ 'label' => __( 'Vertical', 'bdevselement' ), 'type' => Controls_Manager::SLIDER, 'size_units' => ['px'], 'condition' => [ 'arrow_position_toggle' => 'yes' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, ], ], 'selectors' => [ '{{WRAPPER}} .slick-prev, {{WRAPPER}} .slick-next' => 'top: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'arrow_position_x', [ 'label' => __( 'Horizontal', 'bdevselement' ), 'type' => Controls_Manager::SLIDER, 'size_units' => ['px'], 'condition' => [ 'arrow_position_toggle' => 'yes' ], 'range' => [ 'px' => [ 'min' => -100, 'max' => 250, ], ], 'selectors' => [ '{{WRAPPER}} .slick-prev' => 'left: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .slick-next' => 'right: {{SIZE}}{{UNIT}};', ], ] ); $this->end_popover(); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'arrow_border', 'selector' => '{{WRAPPER}} .slick-prev, {{WRAPPER}} .slick-next', ] ); $this->add_responsive_control( 'arrow_border_radius', [ 'label' => __( 'Border Radius', 'bdevselement' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .slick-prev, {{WRAPPER}} .slick-next' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;', ], ] ); $this->start_controls_tabs( '_tabs_arrow' ); $this->start_controls_tab( '_tab_arrow_normal', [ 'label' => __( 'Normal', 'bdevselement' ), ] ); $this->add_control( 'arrow_color', [ 'label' => __( 'Text Color', 'bdevselement' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .slick-prev, {{WRAPPER}} .slick-next' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'arrow_bg_color', [ 'label' => __( 'Background Color', 'bdevselement' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .slick-prev, {{WRAPPER}} .slick-next' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( '_tab_arrow_hover', [ 'label' => __( 'Hover', 'bdevselement' ), ] ); $this->add_control( 'arrow_hover_color', [ 'label' => __( 'Text Color', 'bdevselement' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .slick-prev:hover, {{WRAPPER}} .slick-next:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'arrow_hover_bg_color', [ 'label' => __( 'Background Color', 'bdevselement' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .slick-prev:hover, {{WRAPPER}} .slick-next:hover' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'arrow_hover_border_color', [ 'label' => __( 'Border Color', 'bdevselement' ), 'type' => Controls_Manager::COLOR, 'condition' => [ 'arrow_border_border!' => '', ], 'selectors' => [ '{{WRAPPER}} .slick-prev:hover, {{WRAPPER}} .slick-next:hover' => 'border-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( '_section_style_dots', [ 'label' => __( 'Navigation - Dots', 'bdevselement' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'dots_nav_position_y', [ 'label' => __( 'Vertical Position', 'bdevselement' ), 'type' => Controls_Manager::SLIDER, 'size_units' => ['px'], 'range' => [ 'px' => [ 'min' => -100, 'max' => 500, ], ], 'selectors' => [ '{{WRAPPER}} .slick-dots' => 'bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'dots_nav_spacing', [ 'label' => __( 'Spacing', 'bdevselement' ), 'type' => Controls_Manager::SLIDER, 'size_units' => ['px'], 'selectors' => [ '{{WRAPPER}} .slick-dots li' => 'margin-right: calc({{SIZE}}{{UNIT}} / 2); margin-left: calc({{SIZE}}{{UNIT}} / 2);', ], ] ); $this->add_responsive_control( 'dots_nav_align', [ 'label' => __( 'Alignment', 'bdevselement' ), 'type' => Controls_Manager::CHOOSE, 'label_block' => false, 'options' => [ 'left' => [ 'title' => __( 'Left', 'bdevselement' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'bdevselement' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'bdevselement' ), 'icon' => 'eicon-h-align-right', ], ], 'toggle' => true, 'selectors' => [ '{{WRAPPER}} .slick-dots' => 'text-align: {{VALUE}}' ] ] ); $this->start_controls_tabs( '_tabs_dots' ); $this->start_controls_tab( '_tab_dots_normal', [ 'label' => __( 'Normal', 'bdevselement' ), ] ); $this->add_control( 'dots_nav_color', [ 'label' => __( 'Color', 'bdevselement' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .slick-dots li button:before' => 'color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( '_tab_dots_hover', [ 'label' => __( 'Hover', 'bdevselement' ), ] ); $this->add_control( 'dots_nav_hover_color', [ 'label' => __( 'Color', 'bdevselement' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .slick-dots li button:hover:before' => 'color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( '_tab_dots_active', [ 'label' => __( 'Active', 'bdevselement' ), ] ); $this->add_control( 'dots_nav_active_color', [ 'label' => __( 'Color', 'bdevselement' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .slick-dots .slick-active button:before' => 'color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings_for_display(); $this->add_inline_editing_attributes( 'title', 'basic' ); $this->add_render_attribute( 'title_2', 'class', 'section-title' ); $this->add_render_attribute( 'title', 'class', 'title' ); // button $this->add_inline_editing_attributes( 'button_text', 'none' ); $this->add_render_attribute( 'button_text', 'class', 'bdevs-btn-text' ); $this->add_render_attribute( 'button', 'class', 'bdevs-btn' ); $this->add_link_attributes( 'button', $settings['button_link'] ); $this->add_inline_editing_attributes( 'description', 'intermediate' ); $this->add_render_attribute( 'description', 'class', 'bdevs-card-text' ); if ( empty( $settings['slides'] ) ) { return; } ?> <div class="time-schedule-area pt-50 pb-50"> <div class="container"> <div class="row mt-none-30"> <?php foreach ( $settings['slides'] as $slide ) : ?> <div class="col-xl-3 col-lg-6 col-sm-6 mt-30"> <div class="single-time-schedule"> <div class="icon"> <i class="<?php echo bdevs_element_kses_basic( $slide['icon'] ); ?>"></i> </div> <div class="content"> <h4 class="title"><?php echo bdevs_element_kses_basic( $slide['title'] ); ?></h4> <span><?php echo bdevs_element_kses_basic( $slide['description'] ); ?></span> </div> </div> </div> <?php endforeach; ?> <div class="col-xl-3 col-lg-6 col-sm-6 text-right mt-30"> <?php if ( $settings['button_text'] && ( ( empty( $settings['button_selected_icon'] ) || empty( $settings['button_selected_icon']['value'] ) ) && empty( $settings['button_icon'] ) ) ) : $this->add_render_attribute( 'button', 'class', 'site-btn white' ); printf( '<a %1$s>%2$s</a>', $this->get_render_attribute_string( 'button' ), esc_html( $settings['button_text'] ) ); elseif ( empty( $settings['button_text'] ) && ( ! ( empty( $settings['button_selected_icon'] ) || empty( $settings['button_selected_icon']['value'] ) ) || ! empty( $settings['button_icon'] ) ) ) : ?> <a <?php $this->print_render_attribute_string( 'button' ); ?>><?php bdevs_element_render_icon( $settings, 'button_icon', 'button_selected_icon' ); ?></a> <?php elseif ( $settings['button_text'] && ( ! ( empty( $settings['button_selected_icon'] ) || empty( $settings['button_selected_icon']['value'] ) ) || ! empty( $settings['button_icon'] ) ) ) : if ( $settings['button_icon_position'] === 'before' ) : $button_text = sprintf( '<span %1$s>%2$s</span>', $this->get_render_attribute_string( 'button_text' ), esc_html( $settings['button_text'] ) ); ?> <a <?php $this->print_render_attribute_string( 'button' ); ?>><?php bdevs_element_render_icon( $settings, 'button_icon', 'button_selected_icon', ['class' => 'bdevs-btn-icon'] ); ?> <?php echo $button_text; ?></a> <?php else : $button_text = sprintf( '<span %1$s>%2$s</span>', $this->get_render_attribute_string( 'button_text' ), esc_html( $settings['button_text'] ) ); ?> <a <?php $this->print_render_attribute_string( 'button' ); ?>><?php echo $button_text; ?> <?php bdevs_element_render_icon( $settings, 'button_icon', 'button_selected_icon', ['class' => 'bdevs-btn-icon'] ); ?></a> <?php endif; endif; ?> </div> </div> </div> </div> <?php } }