first commit
This commit is contained in:
@@ -0,0 +1,294 @@
|
||||
<?php namespace THINKAIPLUGIN\Element;
|
||||
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Controls_Stack;
|
||||
use Elementor\Group_Control_Typography;
|
||||
use Elementor\Group_Control_Border;
|
||||
use Elementor\Repeater;
|
||||
use Elementor\Widget_Base;
|
||||
use Elementor\Utils;
|
||||
use Elementor\Group_Control_Text_Shadow;
|
||||
use \Elementor\Group_Control_Box_Shadow;
|
||||
use \Elementor\Group_Control_Background;
|
||||
use \Elementor\Group_Control_Image_Size;
|
||||
use \Elementor\Group_Control_Text_Stroke;
|
||||
use Elementor\Plugin;
|
||||
|
||||
/**
|
||||
* Elementor button widget.
|
||||
* Elementor widget that displays a button with the ability to control every
|
||||
* aspect of the button design.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Testimonial_Review extends Widget_Base {
|
||||
|
||||
/**
|
||||
* Get widget name.
|
||||
* Retrieve button widget name.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return string Widget name.
|
||||
*/
|
||||
public function get_name() {
|
||||
return 'thinkai_testimonial_review';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get widget title.
|
||||
* Retrieve button widget title.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return string Widget title.
|
||||
*/
|
||||
public function get_title() {
|
||||
return esc_html__( 'Thinkai Testimonial Review', 'thinkai' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get widget icon.
|
||||
* Retrieve button widget icon.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return string Widget icon.
|
||||
*/
|
||||
public function get_icon() {
|
||||
return 'eicon-gallery-grid';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get widget categories.
|
||||
* Retrieve the list of categories the button widget belongs to.
|
||||
* Used to determine where to display the widget in the editor.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access public
|
||||
* @return array Widget categories.
|
||||
*/
|
||||
public function get_categories() {
|
||||
return [ 'thinkai' ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Register button widget controls.
|
||||
* Adds different input fields to allow the user to change and customize the widget settings.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*/
|
||||
protected function register_controls() {
|
||||
$this->start_controls_section(
|
||||
'testimonial_review',
|
||||
[
|
||||
'label' => esc_html__( 'Thinkai Testimonial Review', 'thinkai' ),
|
||||
]
|
||||
);
|
||||
//Layout Control
|
||||
$this->add_control(
|
||||
'layout_control',
|
||||
[
|
||||
'label' => esc_html__( 'Layout Style', 'thinkai' ),
|
||||
'label_block' => true,
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '1',
|
||||
'options' => array(
|
||||
'1' => esc_html__( 'Review Slide Left ', 'thinkai'),
|
||||
'2' => esc_html__( 'Review Slide Right ', 'thinkai'),
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
//Repeater
|
||||
$repeater = new Repeater();
|
||||
$repeater->add_control(
|
||||
'transparent_title',
|
||||
[
|
||||
'label' => __( 'BG Transparent Title', 'thinkai' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'label_block' => true,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'placeholder' => __( 'Enter your BG Title', 'thinkai' ),
|
||||
]
|
||||
);
|
||||
//Author Image
|
||||
$repeater->add_control(
|
||||
'author_image',
|
||||
[
|
||||
'label' => __( 'Author Image Url', 'thinkai' ),
|
||||
'type' => Controls_Manager::MEDIA,
|
||||
'default' => ['url' => Utils::get_placeholder_image_src(),],
|
||||
]
|
||||
);
|
||||
//Title
|
||||
$repeater->add_control(
|
||||
'title',
|
||||
[
|
||||
'label' => __( 'Title', 'thinkai' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'label_block' => true,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'placeholder' => __( 'Enter your Title', 'thinkai' ),
|
||||
]
|
||||
);
|
||||
//Designation
|
||||
$repeater->add_control(
|
||||
'designation',
|
||||
[
|
||||
'label' => __( 'Designation', 'thinkai' ),
|
||||
'type' => Controls_Manager::TEXTAREA,
|
||||
'label_block' => true,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'placeholder' => __( 'Enter your Designation', 'thinkai' ),
|
||||
]
|
||||
);
|
||||
//Video Link Option
|
||||
$repeater->add_control(
|
||||
'video_option',
|
||||
[
|
||||
'label' => __( 'Select Video Type', 'thinkai' ),
|
||||
'label_block' => true,
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'src_url',
|
||||
'options' => array(
|
||||
'src_url' => esc_html__( 'Source URL', 'thinkai' ),
|
||||
'src_media' => esc_html__( 'Source Media', 'thinkai' ),
|
||||
),
|
||||
]
|
||||
);
|
||||
$repeater->add_control(
|
||||
'video_link',
|
||||
[
|
||||
'label' => __( 'Video Source Url', 'thinkai' ),
|
||||
'type' => Controls_Manager::URL,
|
||||
'label_block' => true,
|
||||
'placeholder' => __( 'https://your-link.com', 'thinkai' ),
|
||||
'show_external' => true,
|
||||
'default' => [
|
||||
'url' => '',
|
||||
],
|
||||
'condition' => [
|
||||
'video_option' => 'src_url'
|
||||
],
|
||||
]
|
||||
);
|
||||
$repeater->add_control(
|
||||
'video_source_image',
|
||||
[
|
||||
'label' => __( 'Video Source Media', 'thinkai' ),
|
||||
'type' => Controls_Manager::MEDIA,
|
||||
'media_types' => ['video'],
|
||||
'condition' => [
|
||||
'video_option' => 'src_media'
|
||||
],
|
||||
]
|
||||
);
|
||||
$this->add_control(
|
||||
'review',
|
||||
[
|
||||
'label' => __('Add Review Item', 'thinkai'),
|
||||
'type' => Controls_Manager::REPEATER,
|
||||
'fields' => $repeater->get_controls(),
|
||||
'title_field' => '{{{ title }}}',
|
||||
'default' => [
|
||||
[
|
||||
'transparent_title' => esc_html__( 'Review', 'thinkai' ),
|
||||
'title' => esc_html__( 'Boris Elbert', 'thinkai' ),
|
||||
'designation' => esc_html__( 'Manager, Ovalism Studio', 'thinkai' ),
|
||||
'video_link' => esc_html__( 'https://www.youtube.com/watch?v=oV74Najm6Nc', 'thinkai' ),
|
||||
],
|
||||
[
|
||||
'transparent_title' => esc_html__( 'Review', 'thinkai' ),
|
||||
'title' => esc_html__( 'Boris Elbert', 'thinkai' ),
|
||||
'designation' => esc_html__( 'Manager, Ovalism Studio', 'thinkai' ),
|
||||
'video_link' => esc_html__( 'https://www.youtube.com/watch?v=oV74Najm6Nc', 'thinkai' ),
|
||||
],
|
||||
[
|
||||
'transparent_title' => esc_html__( 'Review', 'thinkai' ),
|
||||
'title' => esc_html__( 'Boris Elbert', 'thinkai' ),
|
||||
'designation' => esc_html__( 'Manager, Ovalism Studio', 'thinkai' ),
|
||||
'video_link' => esc_html__( 'https://www.youtube.com/watch?v=oV74Najm6Nc', 'thinkai' ),
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Render button widget output on the frontend.
|
||||
* Written in PHP and used to generate the final HTML.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*/
|
||||
protected function render() {
|
||||
$settings = $this->get_settings_for_display();
|
||||
$allowed_tags = wp_kses_allowed_html('post');
|
||||
$layout = $settings[ 'layout_control' ];
|
||||
?>
|
||||
|
||||
<!--Start Testimonials Style4-->
|
||||
<section class="testimonials-style4 p-0 m-0">
|
||||
<div class="testimonials-style4__inner <?php if($settings[ 'layout_control' ] == '2') echo 'style2'; ?>">
|
||||
<ul class="clearfix <?php if($settings[ 'layout_control' ] == '2') echo 'marquee_mode-language'; else echo 'marquee_mode'; ?>">
|
||||
<?php
|
||||
foreach ($settings['review'] as $keys => $items){
|
||||
|
||||
$video_option = $items[ 'video_option' ];
|
||||
if( $video_option == 'src_url' ){
|
||||
$video = $items[ 'video_link' ][ 'url' ];
|
||||
}elseif( $video_option == 'src_media' ){
|
||||
$video = $items[ 'video_source_image' ]['url'];
|
||||
}else{
|
||||
$video = esc_html__( 'There is no Video', 'thinkai' );
|
||||
}
|
||||
?>
|
||||
<li>
|
||||
<div class="testimonials-style4__single">
|
||||
<?php if($items['transparent_title']){ ?>
|
||||
<div class="big-title">
|
||||
<h2 data-hover="<?php echo esc_attr($items['transparent_title']); ?>"><?php echo wp_kses($items['transparent_title'], true); ?></h2>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="testimonials-style4__single-img">
|
||||
<?php if($items['author_image']){ ?>
|
||||
<div class="inner">
|
||||
<img src="<?php echo esc_url(wp_get_attachment_url($items['author_image']['id'])); ?>" alt="<?php esc_attr_e('Awesome Image','thinkai'); ?>">
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($video){ ?>
|
||||
<div class="testimonials-style4__video">
|
||||
<a class="video-popup" title="Video Gallery" href="<?php echo esc_url( $video );?>">
|
||||
<span class="icon-play-button-arrowhead"></span>
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<div class="testimonials-style4__single-text">
|
||||
<h2><?php echo esc_attr($items['title']); ?></h2>
|
||||
<p><?php echo esc_attr($items['designation']); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user