File "testimonial-widget.php"
Full Path: /home/stylijtl/public_html/wp-content/plugins/acens-elementor/widgets/home-parallax-image/testimonial-widget.php
File size: 9.17 KB
MIME-type: text/x-php
Charset: utf-8
<?php
namespace BdevsElementor\Widget;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Scheme_Typography;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
/**
* Bdevs Elementor Widget.
*
* Elementor widget that inserts an embbedable content into the page, from any given URL.
*
* @since 1.0.0
*/
class BdevsTestimonial extends \Elementor\Widget_Base {
/**
* Get widget name.
*
* Retrieve Bdevs Elementor widget name.
*
* @since 1.0.0
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'bdevs-testimonial';
}
/**
* Get widget title.
*
* Retrieve Bdevs Elementor widget title.
*
* @since 1.0.0
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return __( 'Testimonial Home Parallax Image', 'bdevs-elementor' );
}
/**
* Get widget icon.
*
* Retrieve Bdevs Slider widget icon.
*
* @since 1.0.0
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return 'eicon-favorite';
}
/**
* Get widget categories.
*
* Retrieve the list of categories the Bdevs Slider widget belongs to.
*
* @since 1.0.0
* @access public
*
* @return array Widget categories.
*/
public function get_categories() {
return [ 'pages-elementor' ];
}
public function get_keywords() {
return [ 'testimonial' ];
}
public function get_script_depends() {
return [ 'bdevs-elementor'];
}
// BDT Position
protected function element_pack_position() {
$position_options = [
'' => esc_html__('Default', 'bdevs-elementor'),
'top-left' => esc_html__('Top Left', 'bdevs-elementor') ,
'top-center' => esc_html__('Top Center', 'bdevs-elementor') ,
'top-right' => esc_html__('Top Right', 'bdevs-elementor') ,
'center' => esc_html__('Center', 'bdevs-elementor') ,
'center-left' => esc_html__('Center Left', 'bdevs-elementor') ,
'center-right' => esc_html__('Center Right', 'bdevs-elementor') ,
'bottom-left' => esc_html__('Bottom Left', 'bdevs-elementor') ,
'bottom-center' => esc_html__('Bottom Center', 'bdevs-elementor') ,
'bottom-right' => esc_html__('Bottom Right', 'bdevs-elementor') ,
];
return $position_options;
}
protected function _register_controls() {
$this->start_controls_section(
'section_content_testimonial',
[
'label' => esc_html__( 'Testimonial', 'bdevs-elementor' ),
]
);
$this->add_control(
'subheading',
[
'label' => __( 'Subheading', 'bdevs-elementor' ),
'type' => Controls_Manager::TEXT,
'placeholder' => __( 'Enter your sub heading', 'bdevs-elementor' ),
'default' => __( '', 'bdevs-elementor' ),
'label_block' => true,
]
);
$this->add_control(
'heading',
[
'label' => __( 'Heading', 'bdevs-elementor' ),
'type' => Controls_Manager::TEXT,
'placeholder' => __( 'Enter your heading', 'bdevs-elementor' ),
'default' => __( 'Testimonials', 'bdevs-elementor' ),
'label_block' => true,
]
);
$this->add_control(
'tabs',
[
'label' => esc_html__( 'Testimonial Items', 'bdevs-elementor' ),
'type' => Controls_Manager::REPEATER,
'default' => [
[
'tab_title' => esc_html__( 'Testimonial #1', 'bdevs-elementor' ),
'tab_content' => esc_html__( 'I am item content. Click edit button to change this text.', 'bdevs-elementor' ),
]
],
'fields' => [
[
'name' => 'icon',
'label' => esc_html__( ' Icon ', 'bdevs-elementor' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [ 'active' => true ],
'default' => esc_html__( 'fa-solid fa-ditto' , 'bdevs-elementor' ),
'label_block' => true,
],
[
'name' => 'desc',
'label' => esc_html__( ' Description', 'bdevs-elementor' ),
'type' => Controls_Manager::TEXTAREA,
'dynamic' => [ 'active' => true ],
'default' => esc_html__( '' , 'bdevs-elementor' ),
'label_block' => true,
],
[
'name' => 'image',
'label' => esc_html__( 'Image Avatar', 'bdevs-elementor' ),
'type' => Controls_Manager::MEDIA,
'dynamic' => [ 'active' => true ],
'default' => esc_html__( '' , 'bdevs-elementor' ),
],
[
'name' => 'title',
'label' => esc_html__( 'Title', 'bdevs-elementor' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [ 'active' => true ],
'default' => esc_html__( 'Emily Brown' , 'bdevs-elementor' ),
'label_block' => true,
],
[
'name' => 'subtitle',
'label' => esc_html__( 'Subtitle', 'bdevs-elementor' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [ 'active' => true ],
'default' => esc_html__( 'HLL Company' , 'bdevs-elementor' ),
'label_block' => true,
],
],
]
);
$this->add_control(
'line',
[
'label' => __( 'Line', 'bdevs-elementor' ),
'type' => Controls_Manager::TEXT,
'placeholder' => __( 'Enter your Line', 'bdevs-elementor' ),
'default' => __( 'line-vr-section', 'bdevs-elementor' ),
'label_block' => true,
]
);
$this->end_controls_section();
/**
* Layout section
**/
$this->start_controls_section(
'section_content_layout',
[
'label' => esc_html__( 'Layout', 'bdevs-elementor' ),
]
);
$this->add_responsive_control(
'align',
[
'label' => esc_html__( 'Alignment', 'bdevs-elementor' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'bdevs-elementor' ),
'icon' => 'fa fa-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'bdevs-elementor' ),
'icon' => 'fa fa-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'bdevs-elementor' ),
'icon' => 'fa fa-align-right',
],
'justify' => [
'title' => esc_html__( 'Justified', 'bdevs-elementor' ),
'icon' => 'fa fa-align-justify',
],
],
'prefix_class' => 'elementor%s-align-',
'description' => 'Use align to match position',
'default' => 'left',
]
);
$this->end_controls_section();
}
public function render() {
$settings = $this->get_settings_for_display();
extract($settings);
?>
<section class="testimonials section-padding">
<div class="container">
<div class="row mb-30">
<div class="col-md-12 text-center">
<?php if ( '' !== $settings['subheading'] ) : ?>
<h6 class="wow" data-splitting><?php echo wp_kses_post($settings['subheading']); ?></h6>
<?php endif; ?>
<?php if ( '' !== $settings['heading'] ) : ?>
<h1 class="wow" data-splitting><?php echo wp_kses_post($settings['heading']); ?></h1>
<?php endif; ?>
<div class="line-hr-section center"></div>
</div>
</div>
<div class="row">
<div class="col-md-10 offset-md-1">
<div class="owl-carousel owl-theme">
<?php
$idd = 0;
foreach ( $settings['tabs'] as $item ) :
$idd++;
?>
<div class="item"> <span class="quote"><i class="<?php echo wp_kses_post($item['icon']); ?>"></i></span>
<p><?php echo wp_kses_post($item['desc']); ?></p>
<div class="info">
<div class="author-img img-grayscale"> <img src="<?php print esc_url($item['image']['url']); ?>" alt=""> </div>
<div class="cont">
<h6><?php echo wp_kses_post($item['title']); ?></h6> <span><?php echo wp_kses_post($item['subtitle']); ?></span>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</section>
<!-- divider line -->
<?php if ( '' !== $settings['line'] ) : ?>
<div class="<?php echo wp_kses_post($settings['line']); ?>"></div>
<?php endif; ?>
<?php if (is_admin()) { ?>
<script type="text/javascript">
$('.testimonials .owl-carousel').owlCarousel({
loop:true,
margin: 30,
mouseDrag:true,
autoplay: false,
autoplayTimeout: 7000,
dots: true,
nav: false,
navText: ['<i class="fa-solid fa-angle-left"></i>', '<i class="fa-solid fa-angle-right"></i>'],
responsiveClass:true,
responsive:{
0:{
items: 1,
},
600:{
items: 1,
},
1000:{
items: 2,
}
}
});
</script>
<?php } ?>
<?php
}
}