<?php
/**
* Elementor Single Widget
* @package Prinox Tools
* @since 1.0.0
*/
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
class Prinox_Project_Two 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-project-two-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 Project Two', '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_projects_option',
[
'label' => esc_html__( 'Projects Option', 'prinox-tools' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'case_stydy_title', [
'label' => esc_html__( 'Casestudy Title', 'prinox-tools' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
]
);
$this->add_control(
'case_count', [
'label' => esc_html__( 'Casestudy Count', 'prinox-tools' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
]
);
$this->add_control(
'video_title', [
'label' => esc_html__( 'Video Title', 'prinox-tools' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
]
);
$this->add_control(
'video2_link', [
'label' => esc_html__( 'Video Link', 'prinox-tools' ),
'type' => Controls_Manager::URL,
'label_block' => true,
]
);
$this->add_control(
'description', [
'label' => esc_html__( 'Description', 'prinox-tools' ),
'type' => Controls_Manager::TEXTAREA,
'label_block' => true,
]
);
$repeater2 = new Repeater();
$repeater2->add_control(
'projectorder',
[
'label' => esc_html__( 'Project Order', 'prinox-tools' ),
'type' => Controls_Manager::SELECT,
'default' => 'ASC',
'options' => [
'ASC' => esc_html__( 'Ascending', 'prinox-tools' ),
'DESC' => esc_html__( 'Descending', 'prinox-tools' ),
],
]
);
$repeater2->add_control(
'pjt_per_page',
[
'label' => __( 'Posts Per Page', 'prinox-tools' ),
'type' => Controls_Manager::NUMBER,
'min' => 1,
'default' => 5,
]
);
$repeater2->add_control(
'project_categories',
[
'type' => Controls_Manager::SELECT2,
'label' => esc_html__( 'Select Categories', 'prinox-tools' ),
'options' => prinox_post_category(),
'label_block' => true,
'multiple' => true,
]
);
$this->add_control(
'projects_slider',
[
'label' => esc_html__( 'Add Slider Collumn Item', 'prinox-tools' ),
'type' => Controls_Manager::REPEATER,
'fields' => $repeater2->get_controls(),
]
);
$repeater = new Repeater();
$repeater->add_control(
'heading', [
'label' => esc_html__( 'Heading', 'prinox-tools' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
]
);
$repeater->add_control(
'title', [
'label' => esc_html__( 'Title', 'prinox-tools' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
]
);
$this->add_control(
'infoboxes',
[
'label' => esc_html__( 'Add New Info Box Item', 'prinox-tools' ),
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'title_field' => '{{{ title }}}',
]
);
$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 Link', 'prinox-tools' ),
'type' => Controls_Manager::URL,
'label_block' => true,
]
);
$this->end_controls_section();
$this->start_controls_section(
'content_style',
[
'label' => __( 'Content', 'prinox-tools' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'title_color',
[
'label' => esc_html__( 'Title Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-section-two .title-box h3' => 'color: {{VALUE}} ',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'label' => esc_html__( 'Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .project-section-two .title-box h3',
]
);
$this->add_control(
'count_h',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'Count Number', 'prinox-tools' ),
'separator' => 'before',
]
);
$this->add_control(
'count_number_color',
[
'label' => esc_html__( 'Count Number Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-section-two .title-box .counter' => 'color: {{VALUE}} ',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'count_typography',
'label' => esc_html__( 'Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .project-section-two .title-box .counter',
]
);
$this->add_control(
'play_h',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'Play Icon', '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}} .project-section-two .title-box .play' => '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}} .project-section-two .title-box .play' => '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}} .project-section-two .title-box .play: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}} .project-section-two .title-box .play: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}} .project-section-two .title-box .play:hover' => 'background-color: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'play_title_color',
[
'label' => esc_html__('Title Color', 'prinox-tools'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-section-two .title-box .play-box:hover' => 'color: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'content_h2',
[
'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}} .project-section-two .title-box .text' => 'color: {{VALUE}} ',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'content_typography',
'label' => esc_html__( 'Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .project-section-two .title-box .text',
]
);
$this->end_controls_section();
$this->start_controls_section(
'project_style',
[
'label' => __( 'Project', 'prinox-tools' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'c_bg_color',
[
'label' => esc_html__( 'Overly BG Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-block .image' => 'background-color: {{VALUE}} ',
],
]
);
$this->add_control(
'content_bg_color',
[
'label' => esc_html__( 'Content BG Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-block .content' => 'background-color: {{VALUE}} ',
],
]
);
$this->add_control(
'f_title_h',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'Title', 'prinox-tools' ),
'separator' => 'before',
]
);
$this->add_control(
'c_title_color',
[
'label' => esc_html__( 'Title Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-block h6 a' => 'color: {{VALUE}} ',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'c_title_typography',
'label' => esc_html__( 'Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .project-block h6 a',
]
);
$this->add_control(
'c_link_h',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'Link', 'prinox-tools' ),
'separator' => 'before',
]
);
$this->add_control(
'c_link_color',
[
'label' => esc_html__( 'Link Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-block .inner-box:hover .arrow' => 'color: {{VALUE}} ',
],
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'c_link_bg_color',
'label' => esc_html__( 'Link Background Color', 'prinox-tools' ),
'types' => [ 'classic', 'gradient'],
'exclude' => [
'image',
],
'selector' => '{{WRAPPER}} .project-block .inner-box:hover .arrow',
]
);
$this->end_controls_section();
$this->start_controls_section(
'project_info_style',
[
'label' => __( 'Project Info', 'prinox-tools' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'f_border_color',
[
'label' => esc_html__( 'Border Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-section-two .lower-box' => 'border-color: {{VALUE}} ',
],
]
);
$this->add_control(
'f_wrapper_padding',
[
'label' => esc_html__( 'Padding', 'prinox-tools' ),
'type' => \Elementor\Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .project-section-two .lower-box' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'content_h',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'Content', 'prinox-tools' ),
'separator' => 'before',
]
);
$this->add_control(
'f_sub_title_color',
[
'label' => esc_html__( 'Sub Title Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-section-two .lower-box .title' => 'color: {{VALUE}} ',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'f_sub_title_typography',
'label' => esc_html__( 'Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .project-section-two .lower-box .title',
]
);
$this->add_control(
'title_h',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'Title', 'prinox-tools' ),
'separator' => 'before',
]
);
$this->add_control(
'f_title_color',
[
'label' => esc_html__( 'Title Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-section-two .lower-box h5' => 'color: {{VALUE}} ',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'f_title_typography',
'label' => esc_html__( 'Typography', 'prinox-tools' ),
'selector' => '{{WRAPPER}} .project-section-two .lower-box h5',
]
);
$this->add_control(
'border_h',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'Border', 'prinox-tools' ),
'separator' => 'before',
]
);
$this->add_control(
'border_color',
[
'label' => esc_html__( 'Border Color', 'prinox-tools' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-section-two .lower-box .info-box::before' => 'background-color: {{VALUE}} ',
],
]
);
$this->add_control(
'button_h',
[
'type' => Controls_Manager::HEADING,
'label' => esc_html__( 'Button', 'prinox-tools' ),
'separator' => 'before',
]
);
$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(
'p_play_btn_border_color',
[
'label' => esc_html__('Play Button Border Color', 'prinox-tools'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-section-two .lower-box .play-box' => 'border-color: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'p_play_btn_icon_color',
[
'label' => esc_html__('Play Button Icon Color', 'prinox-tools'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-section-two .lower-box .play-box' => 'color: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'p_play_btn_border_hover',
[
'label' => esc_html__('Play Button Border Hover Color', 'prinox-tools'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-section-two .lower-box .play-box:hover' => 'border-color: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'p_play_btn_icon_hover',
[
'label' => esc_html__('Play Button Icon Hover Color', 'prinox-tools'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-section-two .lower-box .play-box:hover' => 'color: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'p_play_btn_bg_hover',
[
'label' => esc_html__('Play Button BG Hover Color', 'prinox-tools'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .project-section-two .lower-box .play-box:hover' => 'background-color: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
?>
<!-- Project Section Two -->
<section class="project-section-two">
<div class="auto-container">
<!-- Title Box -->
<div class="title-box">
<div class="d-flex justify-content-between align-items-center flex-wrap">
<div>
<?php if(!empty($settings['case_stydy_title'])):?>
<h3><?php echo wp_kses( $settings['case_stydy_title'], true )?></h3>
<?php endif;?>
<?php if(!empty($settings['case_count'])):?>
<div class="counter"><span class="odometer" data-count="<?php echo esc_attr($settings['case_count']) ?>"></span></div>
<?php endif;?>
</div>
<!-- Play Box -->
<?php if(!empty($settings['video_title'])):?>
<div class="play-box">
<a href="<?php echo esc_url($settings['video2_link']['url']);?>" class="lightbox-video play"><span class="fa fa-play"></span><i class="ripple"></i></a>
<?php echo esc_html($settings['video_title']);?>
</div>
<?php endif;?>
<?php if(!empty($settings['description'])):?>
<div>
<div class="text"><?php echo wp_kses( $settings['description'], true );?></div>
</div>
<?php endif;?>
</div>
</div>
</div>
<!--Isotope Galery-->
<div class="outer-container">
<?php $i = 0; foreach($settings['projects_slider'] as $item): $i++;
$args = array(
'post_type' => 'prinox_projects',
'posts_per_page' => !empty( $item['pjt_per_page'] ) ? $item['pjt_per_page'] : 1,
'post_status' => 'publish',
'ignore_sticky_posts' => 1,
'order' => $item['projectorder'],
);
if( ! empty($item['project_categories'] ) ){
$args['projects_cate'] = implode(',', $item['project_categories']);
}
$query = new \WP_Query( $args );
?>
<!-- Project Slide -->
<div class="<?php if($i == 1){ echo esc_attr('project_slide');}else{echo esc_attr('project_slide2');}?> d-flex">
<?php
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
$prinox_thumb_size = 'prinox-img-size-3';
$tags = get_the_tags(get_the_ID());
?>
<!-- Project Block -->
<div class="project-block">
<div class="inner-box">
<div class="image">
<a href="<?php the_permalink();?>"><?php the_post_thumbnail( $prinox_thumb_size );?></a>
<div class="content">
<h6><a href="<?php the_permalink();?>"><?php the_title();?></a></h6>
<a class="arrow flaticon-right-arrow" href="<?php the_permalink();?>"></a>
</div>
</div>
</div>
</div>
<?php } wp_reset_query(); } ?>
</div>
<?php endforeach;?>
</div>
<div class="auto-container">
<!-- Lower Box -->
<div class="lower-box">
<div class="d-flex justify-content-between align-items-center flex-wrap">
<?php foreach($settings['infoboxes'] as $item):?>
<!-- Info Box -->
<div class="info-box">
<div class="title"><?php echo esc_html($item['heading']);?></div>
<h5><?php echo esc_html($item['title']);?></h5>
</div>
<!-- Info Box -->
<?php endforeach;?>
<div class="info-box d-flex">
<?php if(!empty($settings['video_link']['url'])):?>
<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;?>
<?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 esc_html($settings['button_label']);?></span>
<span class="text-two"><?php echo esc_html($settings['button_label']);?></span>
</span>
<span class="icon flaticon-right-arrow"></span>
</a>
</div>
<?php endif;?>
</div>
</div>
</div>
<!-- End Lower Box -->
</div>
</section>
<!-- End Project Section Two -->
<?php
}
}
Plugin::instance()->widgets_manager->register( new Prinox_Project_Two() );