Files
2024-11-04 20:48:19 +01:00

623 lines
27 KiB
PHP

<?php
namespace Elementor;
class restly_testimonial_v6_Widget extends Widget_Base {
public function get_name() {
return 'restly_testimonial_v6';
}
public function get_title() {
return esc_html__( 'Restly Testimonial V6', 'restlycore' );
}
public function get_icon() {
return 'eicon-testimonial-carousel';
}
public function get_categories() {
return ['restly'];
}
protected function register_controls() {
//Content tab start
$this->start_controls_section(
'restly_testimonial_v6_options',
[
'label' => esc_html__( 'Restly Testimonial V6', 'restlycore' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$repeater = new \Elementor\Repeater();
$repeater->add_control(
'restly_test_v6_title', [
'label' => esc_html__( 'Title', 'restlycore' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__( 'David Jon' , 'restlycore' ),
'label_block' => true,
]
);
$repeater->add_control(
'restly_test_v6_stitle', [
'label' => esc_html__( 'Sub Title', 'restlycore' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => esc_html__( 'Founder & CEO' , 'restlycore' ),
'label_block' => true,
]
);
$repeater->add_control(
'restly_test_v6_dec', [
'label' => esc_html__( 'Content', 'restlycore' ),
'type' => \Elementor\Controls_Manager::WYSIWYG,
'default' => esc_html__( 'Aenean volutpat in massa at quis viverra lacus, ac interdum Quisque pretium metus id molestie aliquet. In nec neque in metus placerat Sed in bibendum lorem.' , 'restlycore' ),
'show_label' => false,
]
);
$repeater->add_control(
'restly_test_v6_img',
[
'label' => __( 'Upload Image', 'restlycore' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
],
]
);
$this->add_control(
'restly_testi6',
[
'label' => esc_html__( 'Items List', 'restlycore' ),
'type' => \Elementor\Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
[
'restly_test_v6_title' => esc_html__( 'David Beckham', 'restlycore' ),
'restly_test_v6_stitle' => esc_html__( 'Founder & CEO', 'restlycore' ),
'restly_test_v6_dec' => esc_html__( 'Aenean volutpat in massa at quis viverra lacus, ac interdum Quisque pretium metus id molestie aliquet. In nec neque in metus placerat Sed in bibendum lorem.', 'restlycore' ),
],
[
'restly_test_v6_title' => esc_html__( 'David Jon', 'restlycore' ),
'restly_test_v6_stitle' => esc_html__( 'Manager', 'restlycore' ),
'restly_test_v6_dec' => esc_html__( 'Aenean volutpat in massa at quis viverra lacus, ac interdum Quisque pretium metus id molestie aliquet. In nec neque in metus placerat Sed in bibendum lorem.', 'restlycore' ),
],
],
'title_field' => '{{{ restly_test_v6_title }}}',
]
);
$this->add_control(
'restly_testi6_title_tag',
[
'label' => esc_html__( 'Title HTML Tag', 'restlycore' ),
'description' => esc_html__( 'Add HTML Tag For Title', 'restlycore' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'h4',
'options' => [
'h1' => esc_html__( 'H1', 'restlycore' ),
'h2' => esc_html__( 'H2', 'restlycore' ),
'h3' => esc_html__( 'H3', 'restlycore' ),
'h4' => esc_html__( 'H4', 'restlycore' ),
'h5' => esc_html__( 'H5', 'restlycore' ),
'h6' => esc_html__( 'H6', 'restlycore' ),
'p' => esc_html__( 'P', 'restlycore' ),
'span' => esc_html__( 'span', 'restlycore' ),
'div' => esc_html__( 'Div', 'restlycore' ),
],
]
);
$this->add_control(
'restly_testi6_column',
[
'label' => esc_html__( 'Select Column', 'restlycore' ),
'description' => esc_html__( 'Select Item Column', 'restlycore' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '6',
'options' => [
'12' => esc_html__( 'Column One', 'restlycore' ),
'6' => esc_html__( 'Column Two', 'restlycore' ),
'4' => esc_html__( 'Column Three', 'restlycore' ),
'3' => esc_html__( 'Column Four', 'restlycore' ),
'2' => esc_html__( 'Column Six', 'restlycore' ),
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'restly_testi6_css_box',
[
'label' => esc_html__( 'Box', 'restlycore' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->start_controls_tabs(
'restly_testi6_box_tabs'
);
$this->start_controls_tab(
'restly_testi6_box_tabs_normal',
[
'label' => __( 'Normal', 'restlycore' ),
]
);
$this->add_responsive_control(
'restly_testi6_box_aligment',
[
'label' => __( 'Alignment', 'restlycore' ),
'type' => \Elementor\Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => __( 'Left', 'restlycore' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => __( 'Center', 'restlycore' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => __( 'Right', 'restlycore' ),
'icon' => 'eicon-text-align-right',
],
],
'default' => 'left',
'toggle' => true,
'selectors' => [
'{{WRAPPER}} .testimonial-six-item' => 'text-align: {{VALUE}}',
],
]
);
$this->add_group_control(
\Elementor\Group_Control_Background::get_type(),
[
'name' => 'restly_testi6_box_bg',
'label' => esc_html__( 'Background', 'restlycore' ),
'types' => [ 'classic', 'gradient', 'video' ],
'selector' => '{{WRAPPER}} .testimonial-six-item',
]
);
$this->add_group_control(
\Elementor\Group_Control_Border::get_type(),
[
'name' => 'restly_testi6_box_border',
'label' => esc_html__( 'Border', 'restlycore' ),
'selector' => '{{WRAPPER}} .testimonial-six-item',
]
);
$this->add_group_control(
\Elementor\Group_Control_Box_Shadow::get_type(),
[
'name' => 'restly_testi6_box_shadow',
'label' => esc_html__( 'Box Shadow', 'restlycore' ),
'selector' => '{{WRAPPER}} .testimonial-six-item',
]
);
$this->add_responsive_control(
'restly_testi6_box_radius',
[
'label' => esc_html__( 'Border Radius', 'restlycore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .testimonial-six-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'restly_testi6_box_margin',
[
'label' => esc_html__( 'Margin', 'restlycore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .testimonial-six-item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'restly_testi6_box_padding',
[
'label' => esc_html__( 'Padding', 'restlycore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .testimonial-six-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'restly_testi6_note',
[
'label' => __( 'Background Icon Options', 'restlycore' ),
'type' => \Elementor\Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_responsive_control(
'restly_testi6_box_icon_color',
[
'label' => esc_html__( 'Icon Color', 'restlycore' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .testimonial-six-item:before' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'restly_testi6_box_icon_typo',
'label' => esc_html__( 'Typography', 'restlycore' ),
'selector' => '{{WRAPPER}} .testimonial-six-item:before',
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'restly_testi6_box_tabs_hover',
[
'label' => __( 'Hover', 'restlycore' ),
]
);
$this->add_group_control(
\Elementor\Group_Control_Background::get_type(),
[
'name' => 'restly_testi6_box_hbg',
'label' => esc_html__( 'Background', 'restlycore' ),
'types' => [ 'classic', 'gradient', 'video' ],
'selector' => '{{WRAPPER}} .testimonial-six-item:hover',
]
);
$this->add_group_control(
\Elementor\Group_Control_Border::get_type(),
[
'name' => 'restly_testi6_box_hborder',
'label' => esc_html__( 'Border', 'restlycore' ),
'selector' => '{{WRAPPER}} .testimonial-six-item:hover',
]
);
$this->add_group_control(
\Elementor\Group_Control_Box_Shadow::get_type(),
[
'name' => 'restly_testi6_box_hshadow',
'label' => esc_html__( 'Box Shadow', 'restlycore' ),
'selector' => '{{WRAPPER}} .testimonial-six-item:hover',
]
);
$this->add_responsive_control(
'restly_testi6_box_hradius',
[
'label' => esc_html__( 'Border Radius', 'restlycore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .testimonial-six-item:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'restly_testi6_hnote',
[
'label' => __( 'Background Icon Options', 'restlycore' ),
'type' => \Elementor\Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_responsive_control(
'restly_testi6_box_icon_hcolor',
[
'label' => esc_html__( 'Icon Color', 'restlycore' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .testimonial-six-item:hover:before' => 'color: {{VALUE}}',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
$this->start_controls_section(
'restly_testi6_css_content_box',
[
'label' => esc_html__( 'Content', 'restlycore' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->start_controls_tabs(
'restly_resti6_content_tabs'
);
$this->start_controls_tab(
'restly_resti6_content_tabs_titles',
[
'label' => __( 'Title', 'restlycore' ),
]
);
$this->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'restly_resti6_content_title_typo',
'label' => esc_html__( 'Typography', 'restlycore' ),
'selector' => '{{WRAPPER}} .testimonial-six-item .testi6-title',
]
);
$this->add_responsive_control(
'restly_resti6_content_title_color',
[
'label' => esc_html__( 'Title Color', 'restlycore' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .testimonial-six-item .testi6-title' => 'color: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'restly_resti6_content_title_hcolor',
[
'label' => esc_html__( 'Title Hover Color', 'restlycore' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .testimonial-six-item:hover .testi6-title' => 'color: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'restly_resti6_content_title_margin',
[
'label' => esc_html__( 'Margin', 'restlycore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .testimonial-six-item .testi6-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'restly_resti6_content_title_padding',
[
'label' => esc_html__( 'Padding', 'restlycore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .testimonial-six-item .testi6-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'restly_testi6_tnote',
[
'label' => __( 'Sub Title Options', 'restlycore' ),
'type' => \Elementor\Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'restly_resti6_content_stitle_typo',
'label' => esc_html__( 'Typography', 'restlycore' ),
'selector' => '{{WRAPPER}} .testimonial-six-item .author-description span',
]
);
$this->add_responsive_control(
'restly_resti6_content_stitle_color',
[
'label' => esc_html__( 'Sub Title Color', 'restlycore' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .testimonial-six-item .author-description span' => 'color: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'restly_resti6_content_stitle_hcolor',
[
'label' => esc_html__( 'Sub Title Hover Color', 'restlycore' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .testimonial-six-item:hover .author-description span' => 'color: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'restly_resti6_content_stitle_margin',
[
'label' => esc_html__( 'Margin', 'restlycore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .testimonial-six-item .author-description span' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'restly_resti6_content_stitle_padding',
[
'label' => esc_html__( 'Padding', 'restlycore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .testimonial-six-item .author-description span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'restly_resti6_content_tabs_dec',
[
'label' => __( 'Description', 'restlycore' ),
]
);
$this->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'restly_resti6_content_dec_typo',
'label' => esc_html__( 'Typography', 'restlycore' ),
'selector' => '{{WRAPPER}} .testi6-dec',
]
);
$this->add_responsive_control(
'restly_resti6_content_dec_color',
[
'label' => esc_html__( 'Title Color', 'restlycore' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .testi6-dec' => 'color: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'restly_resti6_content_dec_hcolor',
[
'label' => esc_html__( 'Title Hover Color', 'restlycore' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .testi6-dec' => 'color: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'restly_resti6_content_dec_margin',
[
'label' => esc_html__( 'Margin', 'restlycore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .testi6-dec' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'restly_resti6_content_dec_padding',
[
'label' => esc_html__( 'Padding', 'restlycore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .testi6-dec' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'restly_resti6_content_tabs_img',
[
'label' => __( 'Image', 'restlycore' ),
]
);
$this->add_responsive_control(
'restly_resti6_content_img_width',
[
'label' => esc_html__( 'Width', 'restlycore' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 30,
'max' => 200,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .testimonial-six-item .author-description img' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'restly_resti6_content_img_height',
[
'label' => esc_html__( 'Height', 'restlycore' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%' ],
'range' => [
'px' => [
'min' => 30,
'max' => 200,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .testimonial-six-item .author-description img' => 'height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'restly_resti6_content_img_radius',
[
'label' => esc_html__( 'Border Radius', 'restlycore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .testimonial-six-item .author-description img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'restly_resti6_content_img_margin',
[
'label' => esc_html__( 'Margin', 'restlycore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .testimonial-six-item .author-description img' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'restly_resti6_content_img_padding',
[
'label' => esc_html__( 'Padding', 'restlycore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .testimonial-six-item .author-description img' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
}
//Render
protected function render() {
$settings = $this->get_settings_for_display();
ob_start();
?>
<div class="testimonial-v6-wrapper">
<div class="testimonial-v6-inner">
<div class="row">
<?php foreach($settings['restly_testi6'] as $testi6 ) :
$this->add_render_attribute( 'restly_test_v6_img', 'src', $testi6['restly_test_v6_img']['url'] );
$this->add_render_attribute( 'restly_test_v6_img', 'alt', \Elementor\Control_Media::get_image_alt( $testi6['restly_test_v6_img'] ) );
$this->add_render_attribute( 'restly_test_v6_img', 'title', \Elementor\Control_Media::get_image_title( $testi6['restly_test_v6_img'] ) );
$this->add_render_attribute( 'restly_test_v6_img', 'class', 'testimonial-6-img' );
?>
<div class="col-xl-<?php echo esc_attr($settings['restly_testi6_column']); ?> col-sm-12 col-12">
<div class="testimonial-six-item wow fadeInUp delay-0-4s animated" style="visibility: visible; animation-name: fadeInUp;">
<div class="testi6-dec">
<?php echo wp_kses_post($testi6['restly_test_v6_dec']); ?>
</div>
<div class="author-description">
<div class="designation">
<?php if(!empty($testi6['restly_test_v6_title'])){
echo '<'.esc_attr($settings['restly_testi6_title_tag']).' class="testi6-title">'.esc_html($testi6['restly_test_v6_title']).'</'.esc_attr($settings['restly_testi6_title_tag']).'>';
}?>
<?php if(!empty($testi6['restly_test_v6_stitle'])){
echo '<span>'.esc_html($testi6['restly_test_v6_stitle']).'</span>';
}?>
</div>
<?php echo \Elementor\Group_Control_Image_Size::get_attachment_image_html( $testi6, 'thumbnail', 'restly_test_v6_img' );?>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<?php
echo ob_get_clean();
}
}
Plugin::instance()->widgets_manager->register( new restly_testimonial_v6_Widget );