/
home
/
rekodeb
/
webmars
/
wp-content
/
plugins
/
calmor-core
/
widgets
/
Upload File
HOME
<?php namespace calmorCore\Widgets; use Elementor\Widget_Base; use Elementor\Controls_Manager; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Background; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Text Typing Effect * * Elementor widget for text typing effect. * * @since 1.7.0 */ class calmor_testimonials extends Widget_Base { public function get_name() { return 'calmor_testimonials'; } public function get_title() { return __( 'Calmer Testimonials', 'calmor-core' ); } public function get_icon() { return ' eicon-testimonial-carousel'; } public function get_categories() { return [ 'calmor-elements' ]; } public function get_style_depends() { return [ 'appart-style', 'appart-responsive', 'owl-carousel' ]; } public function get_script_depends() { return [ 'owl-carousel' ]; } protected function register_controls() { // ---------------------------------------- style content ------------------------------ $this->start_controls_section( 'testimonial_style', [ 'label' => __( 'Testimonials Style', 'calmor-core' ), ] ); $this->add_control( 'select_style', [ 'label' => esc_html__( 'Select Style', 'calmor-core' ), 'type' => Controls_Manager::SELECT, 'label_block' => false, 'options' => [ 'style_1' => 'Style 1', 'style_2' => 'Style 2', ], 'default' => 'style_1' ] ); $this->end_controls_section(); // End style content /** * Style Section */ $this->start_controls_section( 'style_sec', [ 'label' => __( 'General Style ', 'calmor-core' ), 'tab' => Controls_Manager::TAB_STYLE ] ); $this->add_group_control( \Elementor\Group_Control_Background::get_type(), [ 'name' => 'background_testimonaisl', 'label' => esc_html__( 'Item Background', 'calmor-core' ), 'types' => [ 'classic', 'gradient', 'video' ], 'selector' => '{{WRAPPER}} .testimonial_style_two_area .single_item', ] ); $this->add_responsive_control( 'testimonials_section_margin', [ 'label' => esc_html__('Margin', 'calmor-core'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .testimonial_style_two_area .single_item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'testimonials_section_padding', [ 'label' => esc_html__('Padding', 'calmor-core'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .testimonial_style_two_area .single_item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'border', 'label' => esc_html__( 'Border', 'calmor-core' ), 'selector' => '{{WRAPPER}} .testimonial_style_two_area .single_item', ] ); $this->add_responsive_control( 'testimonials_section_border_radius', [ 'label' => esc_html__('Border Radius', 'calmor-core'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .testimonial_style_two_area .single_item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); // ------------------------------ Testimonial items ------------------------------ $this->start_controls_section( 'testimonial_sec', [ 'label' => __( 'Testimonial items', 'calmor-core' ), ] ); $this->add_control( 'testimonials', [ 'label' => __( 'Testimonials', 'calmor-core' ), 'type' => Controls_Manager::REPEATER, 'title_field' => '{{{ author_name }}}', 'fields' => [ [ 'name' => 'author_name', 'label' => esc_html__('Author Name', 'calmor-core'), 'type' => Controls_Manager::TEXT, 'default' => 'Hanson Deck', ], [ 'name' => 'designation', 'type' => Controls_Manager::TEXT, 'label' => esc_html__('Designation', 'calmor-core'), 'default' => 'Developer' ], [ 'name' => 'messages', 'type' => Controls_Manager::TEXTAREA, 'label' => esc_html__('Feedback Text', 'calmor-core'), 'default' => 'Lorem ipsum dolor sit amet consectetur adipiscing elit donec tempus pellentesque dui vel tristique purus justo vestibulum eget lectus non gravida ultrices' ], [ 'name' => 'quot_image', 'type' => Controls_Manager::MEDIA, 'label' => esc_html__('Quote image', 'calmor-core'), ], ], ] ); $this->end_controls_section(); $project = new \Elementor\Repeater(); $this->start_controls_section( 'project_img_features_sec', [ 'label' => __( 'Animation Images', 'calmor-core' ), ] ); $project->add_control( 'project_title', [ 'label' => __( ' Images Title', 'calmor-core' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'default' => 'Best Design project' ] ); $project->add_control( 'project_image', [ 'label' => esc_html__( 'Choose Image', 'calmor-core' ), 'type' => \Elementor\Controls_Manager::MEDIA, 'default' => [ 'url' => \Elementor\Utils::get_placeholder_image_src(), ], ] ); $project->add_control( 'project_img_class', [ 'label' => __( 'Images Class', 'calmor-core' ), 'type' => Controls_Manager::TEXT, 'label_block' => false, 'default' => 'one' ] ); $this->add_control( 'feature_project', [ 'label' => __( 'Animation Images', 'calmor-core' ), 'type' => Controls_Manager::REPEATER, 'title_field' => '{{{ project_title }}}', 'fields' => $project->get_controls(), ] ); $this->end_controls_section(); $this->start_controls_section( 'style_sec_content', [ 'label' => __( 'Content Content', 'calmor-core' ), 'tab' => Controls_Manager::TAB_STYLE ] ); $this->add_control( 'testimonials_title_text_color', [ 'label' => esc_html__('Message Color', 'droit-addons'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .testimonial_style_two_area .single_item .content p' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'testimonials_title_text_typography', 'selector' => '{{WRAPPER}} .testimonial_style_two_area .single_item .content p', ] ); $this->add_control( 'testimonials_author_color', [ 'label' => esc_html__('Author Name Color', 'droit-addons'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .testimonial_style_two_area .single_item .content .info span' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'testimonials_author_name_typography', 'selector' => '{{WRAPPER}} .testimonial_style_two_area .single_item .content .info span', ] ); $this->end_controls_section(); } protected function render() { $this->load_widget_script(); $settings = $this->get_settings(); $select_style = isset($settings['select_style']) ? $settings['select_style'] : ''; $testimonials = isset($settings['testimonials']) ? $settings['testimonials'] : ''; $feature_project = isset($settings['feature_project']) ? $settings['feature_project'] : ''; ?> <?php if($select_style =='style_1'){ ?> <section class="testimonial"> <div class="container"> <div class="min_testimonial_area"> <?php if ( is_array( $testimonials ) && count( $testimonials ) > 0 ) { $i=1; foreach ( $testimonials as $testimonials_info ) { ?> <div class="single_testimonial"> <img src="<?php echo esc_url($testimonials_info['quot_image']['url']); ?>" alt=""> <p><?php echo $testimonials_info['messages']; ?></p> <div class="testimonial_people"> <span class="name"><?php echo $testimonials_info['author_name']; ?></span> <span>/</span> <span class="des"><?php echo $testimonials_info['designation']; ?></span> </div> </div> <?php } } ?> </div> </div> <div class="shape_img"> <?php if ( is_array( $feature_project ) && count( $feature_project ) > 0 ) { $i=1; foreach ( $feature_project as $feature_pro ) { ?> <img src="<?php echo esc_url($feature_pro['project_image']['url']); ?>" alt="" class="<?php echo $feature_pro['project_img_class']; ?> wow fadeInRight" data-wow-delay="0.1s"> <?php } } ?> </div> </section> <?php }elseif($select_style =='style_2'){ ?> <!-- Testimonial Style Two --> <section class="testimonial_style_two"> <div class="container"> <div class="testimonial_style_two_area"> <?php if ( is_array( $testimonials ) && count( $testimonials ) > 0 ) { $i=1; foreach ( $testimonials as $testimonials_info ) { ?> <div class="single_item" data-bg-color="#fff"> <div class="content"> <p><span class="first">”</span><?php echo $testimonials_info['messages']; ?><span>”</span></p> <div class="info"> <span class="name"><?php echo $testimonials_info['author_name']; ?></span> <span>/</span> <span class="des" <?php echo $testimonials_info['designation']; ?></span> </div> </div> <img src="<?php echo esc_url($testimonials_info['quot_image']['url']); ?>" alt=""> </div> <?php } } ?> </div> </div> <div class="shape_img"> <?php if ( is_array( $feature_project ) && count( $feature_project ) > 0 ) { $i=1; foreach ( $feature_project as $feature_pro ) { ?> <img src="<?php echo esc_url($feature_pro['project_image']['url']); ?>" alt="" class="<?php echo $feature_pro['project_img_class']; ?> wow fadeInRight" data-wow-delay="0.1s"> <?php } } ?> </div> </section> <!-- Testimonial Style Two --> <?php }else{ } ?> <?php } public function load_widget_script(){ if( \Elementor\Plugin::$instance->editor->is_edit_mode() === true ) { ?> <script> ( function( $ ){ // main class $('.min_testimonial_area').slick({ autoplay: true, infinite: true, slidesToShow: 1, slidesToScroll: 1, dots: false, arrows: true, speed: 300, prevArrow: '<button type="button" class="slick-prev"><i class="fa-solid fa-angle-left"></i></button>', nextArrow: '<button type="button" class="slick-next"><i class="fa-solid fa-angle-right"></i></button>', }); $('.testimonial_style_two_area').slick({ autoplay: true, infinite: true, slidesToShow: 2, slidesToScroll: 1, dots: false, arrows: true, speed: 300, prevArrow: '<button type="button" class="slick-prev"><i class="fa-solid fa-angle-left"></i></button>', nextArrow: '<button type="button" class="slick-next"><i class="fa-solid fa-angle-right"></i></button>', }); // end Slider Script })(jQuery); </script> <?php } } }