<?php
/**
* Elementor Single Widget
* @package Prinox Tools
* @since 1.0.0
*/
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
class Prinox_Quality 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-quality-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 Quality', '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_about_option',
[
'label' => esc_html__( 'About Option', 'prinox-tools' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'shape', [
'label' => esc_html__( 'Shape Image', 'prinox-tools' ),
'type' => Controls_Manager::MEDIA,
]
);
$this->add_control(
'quality_img', [
'label' => esc_html__( 'Quality Image', 'prinox-tools' ),
'type' => Controls_Manager::MEDIA,
]
);
$this->add_control(
'sub_title', [
'label' => esc_html__( 'Sub Title', 'prinox-tools' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'title-bg',
'label' => esc_html__( 'Background', 'prinox-tools' ),
'types' => [ 'classic' ],
'exclude' => [ 'color' ],
'selector' => '{{WRAPPER}} .sec-title h2 span:before',
]
);
$this->add_control(
'title', [
'label' => esc_html__( 'Title', 'prinox-tools' ),
'type' => Controls_Manager::TEXTAREA,
'label_block' => true,
]
);
$this->add_control(
'description', [
'label' => esc_html__( 'Description', 'prinox-tools' ),
'type' => Controls_Manager::TEXTAREA,
'label_block' => true,
]
);
$repeater = new Repeater();
$repeater->add_control(
'title', [
'label' => esc_html__( 'Title', 'prinox-tools' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
]
);
$this->add_control(
'listitem',
[
'label' => esc_html__( 'Add New List Item', 'prinox-tools' ),
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'title_field' => '{{{ title }}}',
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'short-title-bg',
'label' => esc_html__( 'Background', 'prinox-tools' ),
'types' => [ 'classic' ],
'exclude' => [ 'color' ],
'selector' => '{{WRAPPER}} .quality-section .demand:before',
]
);
$this->add_control(
'shortinfo', [
'label' => esc_html__( 'Short info', 'prinox-tools' ),
'type' => Controls_Manager::TEXTAREA,
'label_block' => true,
]
);
$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->add_control(
'video_link', [
'label' => esc_html__( 'Video URL', 'prinox-tools' ),
'type' => Controls_Manager::URL,
'label_block' => true,
]
);
$this->end_controls_section();
$this->start_controls_section(
'quality_style',
[
'label' => __( 'Quality Style', 'prinox-tools' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$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__( 'Sub Title Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .sec-title .title',
]
);
$this->add_control(
'title_h',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'Title', 'prinox-tools' ),
'separator' => 'before',
]
);
$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__( 'Title Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .sec-title h2',
]
);
$this->add_control(
'content_h',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'Content', 'prinox-tools' ),
'separator' => 'before',
]
);
$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__( 'Content Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .sec-title .text',
]
);
$this->add_control(
'list_h',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'List', 'prinox-tools' ),
'separator' => 'before',
]
);
$this->add_control(
'list_color',
[
'label' => esc_html__( 'List Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .quality-section .options-list li' => 'color: {{VALUE}} ',
],
]
);
$this->add_control(
'icon_color',
[
'label' => esc_html__( 'List Icon Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .quality-section .options-list li::before' => 'color: {{VALUE}} ',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'list_typography',
'label' => esc_html__( 'List Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .quality-section .options-list li',
]
);
$this->add_control(
'text_h',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'Text', 'prinox-tools' ),
'separator' => 'before',
]
);
$this->add_control(
'text_color',
[
'label' => esc_html__( 'Text Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .quality-section .demand' => 'color: {{VALUE}} ',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'text_typography',
'label' => esc_html__( 'Text Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .quality-section .demand',
]
);
$this->end_controls_section();
$this->start_controls_section(
'button_style',
[
'label' => __( 'Button Style', 'prinox-tools' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'button_typography',
'label' => esc_html__( 'Button Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .btn-style-one',
]
);
$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}} .btn-style-one, .btn-style-one::before',
]
);
$this->add_control(
'button_default_text_color',
[
'label' => esc_html__('Text Color', 'prinox-tools'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .btn-style-one .btn-wrap .text-one' => 'color: {{VALUE}};',
'{{WRAPPER}} .btn-style-one .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-one:hover, .btn-style-one:hover::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-one:hover .btn-wrap .text-two' => 'color: {{VALUE}};',
'{{WRAPPER}} .btn-style-one:hover .icon' => 'color: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->end_controls_tabs();
$this->add_control(
'play_button_h',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'Play Button', 'prinox-tools' ),
'separator' => 'before',
]
);
$this->add_control(
'play_btn_border_color',
[
'label' => esc_html__('Play Button Border Color', 'prinox-tools'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .quality-section .play-box' => 'border-color: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'play_btn_icon_color',
[
'label' => esc_html__('Play Button Icon Color', 'prinox-tools'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .quality-section .play-box' => 'color: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'play_btn_border_hover',
[
'label' => esc_html__('Play Button Border Hover Color', 'prinox-tools'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .quality-section .play-box:hover' => 'border-color: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'play_btn_icon_hover',
[
'label' => esc_html__('Play Button Icon Hover Color', 'prinox-tools'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .quality-section .play-box:hover' => 'color: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'play_btn_bg_hover',
[
'label' => esc_html__('Play Button BG Hover Color', 'prinox-tools'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .quality-section .play-box:hover' => 'background-color: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
?>
<!-- Quality Section -->
<section class="quality-section">
<div class="color-one"></div>
<div class="color-two"></div>
<div class="color-three"></div>
<?php if(!empty($settings['shape']['url'])):?>
<div class="vector-layer" style="background-image: url(<?php echo esc_url($settings['shape']['url']);?>)"></div>
<?php endif;?>
<div class="auto-container">
<div class="row clearfix">
<?php if(!empty($settings['quality_img']['url'])):?>
<!-- Images Column -->
<div class="images-column col-lg-6 col-md-12 col-sm-12">
<div class="inner-column">
<div class="image titlt" data-tilt data-tilt-max="4">
<img src="<?php echo esc_url($settings['quality_img']['url']);?>" alt="<?php echo esc_attr($settings['quality_img']['alt']);?>" />
</div>
</div>
</div>
<!-- Content Column -->
<?php endif;?>
<div class="content-column col-lg-6 col-md-12 col-sm-12">
<div class="inner-column">
<!-- Sec Title -->
<div class="sec-title">
<?php if(!empty($settings['sub_title'])):?>
<div class="title style-two"><?php echo wp_kses( $settings['sub_title'], true );?></div>
<?php endif;?>
<?php if(!empty($settings['title'])):?>
<h2><?php echo wp_kses( $settings['title'], true );?></h2>
<?php endif;?>
<?php if(!empty($settings['description'])):?>
<div class="text"><?php echo wp_kses( $settings['description'], true );?></div>
<?php endif;?>
</div>
<!-- Options List -->
<ul class="options-list">
<?php foreach($settings['listitem'] as $item):?>
<li><?php echo wp_kses( $item['title'], true )?></li>
<?php endforeach;?>
</ul>
<?php if(!empty($settings['shortinfo'])):?>
<!-- Demand -->
<div class="demand"><?php echo wp_kses( $settings['shortinfo'], true );?></span></div>
<?php endif;?>
<!-- Info Box -->
<div class="info-box d-flex">
<?php if(!empty($settings['button_label'])):?>
<!-- Button Box -->
<div class="button-box">
<a href="<?php echo esc_url($settings['button_link']['url']);?>" class="theme-btn btn-style-one clearfix">
<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>
</a>
</div>
<?php endif;?>
<?php if(!empty($settings['video_link']['url'])):?>
<!-- Play Box -->
<a href="<?php echo esc_url($settings['video_link']['url']);?>" class="lightbox-video play-box"><span class="fa fa-play"></span><i class="ripple"></i></a>
<?php endif;?>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- End Quality Section -->
<?php
}
}
Plugin::instance()->widgets_manager->register( new Prinox_Quality() );