Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
wp-content
/
plugins
/
prinox-tools
/
elementor
/
widgets
:
openign-time.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php /** * Elementor Single Widget * @package Prinox Tools * @since 1.0.0 */ namespace Elementor; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. class Prinox_Opening_Time extends Widget_Base { /** * Get widget name. * * Retrieve Elementor widget name. * * @since 1.0.0 * @access public * * @return string Widget name. */ public function get_name() { return 'prionx-opening-time'; } /** * Get widget title. * * Retrieve Elementor widget title. * * @since 1.0.0 * @access public * * @return string Widget title. */ public function get_title() { return esc_html__( 'Prinox Opening Time Sponsor', 'prinox-tools' ); } /** * Get widget icon. * * Retrieve Elementor widget icon. * * @since 1.0.0 * @access public * * @return string Widget icon. */ public function get_icon() { return 'mg-custom-icon'; } /** * Get widget categories. * * Retrieve the list of categories the Elementor widget belongs to. * * @since 1.0.0 * @access public * * @return array Widget categories. */ public function get_categories() { return [ 'prinox_widgets' ]; } protected function register_controls() { $this->start_controls_section( 'prinox_time_option', [ 'label' => esc_html__( 'Opening Time Option', 'prinox-tools' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $repeater = new Repeater(); $repeater->add_control( 'days', [ 'label' => esc_html__( 'Days Name', 'prinox-tools' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, ] ); $repeater->add_control( 'time', [ 'label' => esc_html__( 'Time', 'prinox-tools' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, ] ); $this->add_control( 'opentimes', [ 'label' => esc_html__( 'Add Time Item', 'prinox-tools' ), 'type' => Controls_Manager::REPEATER, 'fields' => $repeater->get_controls(), 'title_field' => '{{{ days }}} - {{{ time }}}', ] ); $this->add_control( 'button_label', [ 'label' => esc_html__( 'Button Label', 'prinox-tools' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, ] ); $this->add_control( 'button_link', [ 'label' => esc_html__( 'Button Link', 'prinox-tools' ), 'type' => Controls_Manager::URL, 'label_block' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'opening_time_style', [ 'label' => __( 'Opening Time Style', 'prinox-tools' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'ot_color', [ 'label' => esc_html__( 'Color', 'prinox-tools' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .time-list li' => 'color: {{VALUE}} ', ], ] ); $this->add_control( 'ot_border_color', [ 'label' => esc_html__( 'Border Color', 'prinox-tools' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .time-list li' => 'border-color: {{VALUE}} ', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'ot_typography', 'label' => esc_html__( 'Typography', 'prinox-tools' ), 'selector' => '{{WRAPPER}} .time-list li', ] ); $this->end_controls_section(); $this->start_controls_section( 'button_style', [ 'label' => __( 'Button Style', 'prinox-tools' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'button_padding', [ 'label' => esc_html__( 'Padding', 'prinox-tools' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .timing-widget .button-box .theme-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'button_typography', 'label' => esc_html__( 'Button Typography', 'prinox-tools' ), 'selector' => '{{WRAPPER}} .timing-widget .button-box .theme-btn', ] ); $this->start_controls_tabs('button_style_tabs'); //Default style tab start $this->start_controls_tab( 'btn_style_default', [ 'label' => esc_html__('Normal', 'prinox-tools'), ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'button_bg', 'label' => esc_html__( 'Background', 'prinox-tools' ), 'types' => [ 'classic', 'gradient'], 'exclude' => [ 'image', ], 'selector' => '{{WRAPPER}} .timing-widget .button-box .theme-btn', ] ); $this->add_control( 'button_default_text_color', [ 'label' => esc_html__('Text Color', 'prinox-tools'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .btn-style-four .btn-wrap .text-one' => 'color: {{VALUE}};', '{{WRAPPER}} .btn-style-four .icon' => 'color: {{VALUE}};', ], 'separator' => 'before', ] ); $this->end_controls_tab(); //Hover style tab start $this->start_controls_tab( 'btn_style_hover', [ 'label' => esc_html__('Hover', 'prinox-tools'), ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'button_hover_bg', 'label' => esc_html__( 'Background', 'prinox-tools' ), 'types' => [ 'classic', 'gradient'], 'selector' => '{{WRAPPER}} .btn-style-four::before', 'exclude' => [ 'image', ], ] ); $this->add_control( 'button_hover_text_color', [ 'label' => esc_html__('Text Color', 'prinox-tools'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .btn-style-four .btn-wrap .text-two' => 'color: {{VALUE}};', '{{WRAPPER}} .btn-style-four:hover .icon' => 'color: {{VALUE}};', ], 'separator' => 'before', ] ); $this->end_controls_tabs(); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings_for_display(); ?> <div class="timing-widget"> <div class="widget-content"> <?php if(!empty($settings['opentimes'])):?> <ul class="time-list"> <?php foreach($settings['opentimes'] as $item):?> <li><?php echo wp_kses($item['days'], true);?> <span><?php echo wp_kses($item['time'], true);?></span></li> <?php endforeach;?> </ul> <?php endif;?> <?php if(!empty($settings['button_label'])):?> <div class="button-box"> <button class="theme-btn btn-style-four"> <span class="btn-wrap"> <span class="text-one"><?php echo wp_kses($settings['button_label'], true);?></span> <span class="text-two"><?php echo wp_kses($settings['button_label'], true);?></span> </span> <span class="icon flaticon-right-arrow"></span> </button> </div> <?php endif;?> </div> </div> <?php } } Plugin::instance()->widgets_manager->register( new Prinox_Opening_Time() );