• File: testimonial.php
  • Full Path: /home/slvgwrnz/public_html/wp-content/plugins/prinox-tools/elementor/widgets/testimonial.php
  • Date Modified: 02/05/2025 11:48 AM
  • File size: 14.55 KB
  • MIME-type: text/x-php
  • Charset: utf-8
<?php

/**
 * Elementor Single Widget
 * @package Prinox Tools
 * @since 1.0.0
 */

namespace Elementor;

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.

class Prinox_Testimonial 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-testimonial-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 Testimonial', '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_testimonial_option',
			[
				'label' => esc_html__( 'Testimonial 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(
			'shape2', [
				'label'       => esc_html__( 'Shape2 Image', 'prinox-tools' ),
				'type'        => Controls_Manager::MEDIA,
			]
		);
		
        $repeater = new Repeater();		
		$repeater->add_control(
			'circle_shape', [
				'label' => esc_html__( 'Circle Shape', 'prinox-tools' ),
				'type' => Controls_Manager::MEDIA,
                'label_block' => true,
			]
		);
		$repeater->add_control(
			'circle_shape2', [
				'label' => esc_html__( 'Circle Shape 2', 'prinox-tools' ),
				'type' => Controls_Manager::MEDIA,
                'label_block' => true,
			]
		);
		$repeater->add_control(
			'authore_img', [
				'label' => esc_html__( 'Authore Image', 'prinox-tools' ),
				'type' => Controls_Manager::MEDIA,
                'label_block' => true,
			]
		);
		$repeater->add_control(
			'title', [
				'label' => esc_html__( 'Title', 'prinox-tools' ),
				'type' => Controls_Manager::TEXT,
                'label_block' => true,
			]
		);
		$repeater->add_control(
			'authore_name', [
				'label' => esc_html__( 'Name', 'prinox-tools' ),
				'type' => Controls_Manager::TEXT,
                'label_block' => true,
			]
		);
		$repeater->add_control(
			'designation', [
				'label' => esc_html__( 'Designation', 'prinox-tools' ),
				'type' => Controls_Manager::TEXT,
                'label_block' => true,
			]
		);
		$repeater->add_control(
			'feedback', [
				'label' => esc_html__( 'Feedback', 'prinox-tools' ),
				'type' => Controls_Manager::TEXTAREA,
                'label_block' => true,
			]
		);
		$repeater->add_control(
			'socil1', [
				'label' => esc_html__( 'Social 1', 'prinox-tools' ),
				'type' => Controls_Manager::ICONS,
                'label_block' => true,
			]
		);
		$repeater->add_control(
			'socil1_link', [
				'label' => esc_html__( 'Social 1 Link', 'prinox-tools' ),
				'type' => Controls_Manager::URL,
                'label_block' => true,
			]
		);
		$repeater->add_control(
			'socil2', [
				'label' => esc_html__( 'Social 2', 'prinox-tools' ),
				'type' => Controls_Manager::ICONS,
                'label_block' => true,
			]
		);
		$repeater->add_control(
			'socil2_link', [
				'label' => esc_html__( 'Social 2 Link', 'prinox-tools' ),
				'type' => Controls_Manager::URL,
                'label_block' => true,
			]
		);
		$repeater->add_control(
			'socil3', [
				'label' => esc_html__( 'Social 3', 'prinox-tools' ),
				'type' => Controls_Manager::ICONS,
                'label_block' => true,
			]
		);
		$repeater->add_control(
			'socil3_link', [
				'label' => esc_html__( 'Social 3 Link', 'prinox-tools' ),
				'type' => Controls_Manager::URL,
                'label_block' => true,
			]
		);
		$repeater->add_control(
			'socil4', [
				'label' => esc_html__( 'Social 4', 'prinox-tools' ),
				'type' => Controls_Manager::ICONS,
                'label_block' => true,
			]
		);
		$repeater->add_control(
			'socil4_link', [
				'label' => esc_html__( 'Social 4 Link', 'prinox-tools' ),
				'type' => Controls_Manager::URL,
                'label_block' => true,
			]
		);
		
		$this->add_control(
			'testimonials',
			[
				'label' => esc_html__( 'Add New Testimonial Item', 'prinox-tools' ),
				'type' => Controls_Manager::REPEATER,
				'fields' => $repeater->get_controls(),
                'title_field' => '{{{ authore_name }}}',
			]
		);
		
		$this->end_controls_section();

		
		$this->start_controls_section(
            'testimonial_style',
            [
                'label' => __( 'Casestudy Style', '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}} .testimonial-block h3' => 'color: {{VALUE}} ',
                ],
            ]
        );
        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name'           => 'title_typography',
                'label'          => esc_html__( 'Typography', 'prinox-tools' ),
                'selector'       => '{{WRAPPER}} .testimonial-block h3',
            ]
        );

		$this->add_control(
            'content',
            [
                '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}} .testimonial-block .text' => 'color: {{VALUE}} ',
                ],
            ]
        );
		$this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name'           => 'content_typography',
                'label'          => esc_html__( 'Typography', 'prinox-tools' ),
                'selector'       => '{{WRAPPER}} .testimonial-block .text',
            ]
        );
		$this->add_control(
            'info_h',
            [
                'type'      => Controls_Manager::HEADING,
                'label'     => esc_html__( 'Author Info', 'prinox-tools' ),
                'separator' => 'before',
            ]
        );

		$this->add_control(
            'author_info_color',
            [
                'label'     => esc_html__( 'Author Info Color', 'prinox-tools' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .testimonial-block .author-info' => 'color: {{VALUE}} ',
                ],
            ]
        );
		$this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name'           => 'author_info_typography',
                'label'          => esc_html__( 'Typography', 'prinox-tools' ),
                'selector'       => '{{WRAPPER}} .testimonial-block .author-info',
            ]
        );

		$this->add_control(
            'donts_h',
            [
                'type'      => Controls_Manager::HEADING,
                'label'     => esc_html__( 'Donts', 'prinox-tools' ),
                'separator' => 'before',
            ]
        );

		$this->add_control(
            'dotns_color',
            [
                'label'     => esc_html__( 'Dots Color', 'prinox-tools' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .testimonial-section .owl-dots .owl-dot span' => 'color: {{VALUE}} ',
                ],
            ]
        );
		$this->add_control(
            'dotns_active_color',
            [
                'label'     => esc_html__( 'Dots Active Color', 'prinox-tools' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .testimonial-section .owl-dots .owl-dot:hover span' => 'color: {{VALUE}} ',
                    '{{WRAPPER}} .testimonial-section .owl-dots .owl-dot.active span' => 'color: {{VALUE}} ',
                    '{{WRAPPER}} .testimonial-section .owl-dots .owl-dot span::after' => 'background-color: {{VALUE}} ',
                ],
            ]
        );
		$this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name'           => 'dots_typography',
                'label'          => esc_html__( 'Typography', 'prinox-tools' ),
                'selector'       => '{{WRAPPER}} .testimonial-section .owl-dots .owl-dot span',
            ]
        );

		$this->end_controls_section();

		$this->start_controls_section(
            'testimonial_social_style',
            [
                'label' => __( 'Social Icon', 'prinox-tools' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );

		$this->add_control(
            'social_color',
            [
                'label'     => esc_html__( 'Social Color', 'prinox-tools' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .testimonial-block .social-box li a' => 'color: {{VALUE}} ',
                ],
            ]
        );

		$this->add_control(
            'social_hover_color',
            [
                'label'     => esc_html__( 'Social Hover Color', 'prinox-tools' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .testimonial-block .social-box li a:hover' => 'color: {{VALUE}} ',
                ],
            ]
        );

		$this->end_controls_section();
	}


	protected function render() {
		$settings = $this->get_settings_for_display();		

    ?>
   <!-- Testimonial Section -->
	<section class="testimonial-section">
		<div class="icon-one"></div>
		<div class="icon-two"></div>
		<div class="icon-three"></div>
        <?php if($settings['shape']['url']):?>
		<div class="vector-icon-one paroller" data-paroller-factor="-0.20" data-paroller-factor-lg="0.20" data-paroller-type="foreground" data-paroller-direction="vertical" style="background-image:url(<?php echo esc_url($settings['shape']['url']);?>)"></div>
        <?php endif;?>

        <?php if($settings['shape2']['url']):?>
		    <div class="vector-icon-two" style="background-image: url(<?php echo esc_url($settings['shape2']['url']);?>)"></div>
        <?php endif;?>

		<div class="auto-container">
			<div class="inner-container">
				<div class="single-item-carousel owl-carousel owl-theme">
					<?php foreach($settings['testimonials'] as $item):?>
					<!-- Testimonial Block -->
					<div class="testimonial-block">
						<div class="inner-box">
							<div class="row clearfix">
								<!-- Image Column -->
								<div class="image-column col-lg-4 col-md-12 col-sm-12">
									<div class="inner-column">
                                        <?php if($item['circle_shape']['url']):?>
										    <div class="circle-layer" style="background-image: url(<?php echo esc_url($item['circle_shape']['url']);?>)"></div>
                                        <?php endif;?>

                                        <?php if($item['circle_shape2']['url']):?>
										<div class="pattern-layer" style="background-image: url(<?php echo esc_url($item['circle_shape2']['url']);?>)"></div>
                                        <?php endif;?>
										<div class="quote-icon flaticon-quote"></div>
										
										<div class="image">
                                            <?php if($item['authore_img']['url']):?>
											    <img src="<?php echo esc_url($item['authore_img']['url']);?>" alt="<?php echo esc_attr($item['authore_img']['alt']);?>" />
                                            <?php endif;?>
											<!-- Social Box -->
											<ul class="social-box">

                                                <?php if($item['socil1']):?>
												<li><a href="<?php echo esc_url($item['socil1_link']['url']);?>"><?php \Elementor\Icons_Manager::render_icon( $item['socil1'], [ 'aria-hidden' => 'true' ] ); ?></a></li>
                                                <?php endif;?>

                                                <?php if($item['socil2']):?>
												<li><a href="<?php echo esc_url($item['socil2_link']['url']);?>"><?php \Elementor\Icons_Manager::render_icon( $item['socil2'], [ 'aria-hidden' => 'true' ] ); ?></a></li>
                                                <?php endif;?>

                                                <?php if($item['socil3']):?>
												<li><a href="<?php echo esc_url($item['socil3_link']['url']);?>"><?php \Elementor\Icons_Manager::render_icon( $item['socil3'], [ 'aria-hidden' => 'true' ] ); ?></a></li>
                                                <?php endif;?>

                                                <?php if($item['socil4']):?>
												<li><a href="<?php echo esc_url($item['socil4_link']['url']);?>"><?php \Elementor\Icons_Manager::render_icon( $item['socil4'], [ 'aria-hidden' => 'true' ] ); ?></a></li>
                                                <?php endif;?>

											</ul>
										</div>
									</div>
								</div>
								<!-- Content Column -->
								<div class="content-column col-lg-8 col-md-12 col-sm-12">
									<div class="inner-column">
                                        <?php if(!empty($item['title'])):?>
										    <h3><?php echo wp_kses( $item['title'], true )?></h3>
                                        <?php endif;?>
										<div class="text"><?php echo wp_kses( $item['feedback'], true )?></div>
										<!-- Author Info -->
										<div class="author-info">
											<span><?php echo wp_kses( $item['authore_name'], true )?></span> <?php echo wp_kses( $item['designation'], true )?>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<?php endforeach;?>
				</div>
			</div>
		</div>
	</section>
	<!-- End Testimonial Section -->
    <?php 
    }
		
	
}


Plugin::instance()->widgets_manager->register( new Prinox_Testimonial() );