<?php
/**
* Elementor Single Widget
* @package prinox Tools
* @since 1.0.0
*/
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
class Prinox_CountDown 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 'prinox-countdown-id';
}
/**
* 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 Countdown', '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_banner_option',
[
'label' => esc_html__( 'Count Down Option', 'prinox-tools' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'year', [
'label' => esc_html__( 'Year', 'prinox-tools' ),
'default' => esc_html__( '2024', 'prinox-tools' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
]
);
$this->add_control(
'month', [
'label' => esc_html__( 'Month', 'prinox-tools' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
]
);
$this->end_controls_section();
$this->start_controls_section(
'content_style',
[
'label' => __( 'Content Style', 'prinox-tools' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'section_bg_color',
[
'label' => esc_html__( 'Section BG Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .app-section' => 'background-color: {{VALUE}}',
],
]
);
$this->add_control(
'subtitle_hr',
[
'type' => \Elementor\Controls_Manager::DIVIDER,
]
);
$this->add_control(
'subtitle_color',
[
'label' => esc_html__( 'Sub Title Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .sec-title .title' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'subtitle_bg_color',
[
'label' => esc_html__( 'Sub Title BG Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .sec-title .title::before' => 'background-color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'subtitle_typography',
'label' => esc_html__( 'Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .sec-title .title',
]
);
$this->add_control(
'b_title_hr',
[
'type' => \Elementor\Controls_Manager::DIVIDER,
]
);
$this->add_control(
'title_color',
[
'label' => esc_html__( 'Title Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .sec-title h2' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'label' => esc_html__( 'Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .sec-title h2',
]
);
$this->add_control(
'content_hr',
[
'type' => \Elementor\Controls_Manager::DIVIDER,
]
);
$this->add_control(
'content_color',
[
'label' => esc_html__( 'Content Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .sec-title .text' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'content_typography',
'label' => esc_html__( 'Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .sec-title .text',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
?>
<script type="text/javascript">
jQuery(window).load(function() {
jQuery('#myCounter').mbComingsoon({ expiryDate: new Date(<?php echo esc_attr($settings['year']);?>, 0, 1, 9, 30), speed:100 });
});
</script>
<div>
<div class="row centered text-center" id="myCounter"></div>
</div>
<?php
}
}
Plugin::instance()->widgets_manager->register( new Prinox_CountDown() );