| 1 |
<?php |
| 2 |
namespace UiCoreElements; |
| 3 |
|
| 4 |
defined('ABSPATH') || exit(); |
| 5 |
|
| 6 |
/** |
| 7 |
* Testimonial Slider |
| 8 |
* |
| 9 |
* Use Testimonial Carousel as base |
| 10 |
* |
| 11 |
* @author Lucas Marini Falbo <lucas@uicore.co> |
| 12 |
* @since 1.0.1 |
| 13 |
*/ |
| 14 |
|
| 15 |
class TestimonialSlider extends TestimonialCarousel |
| 16 |
{ |
| 17 |
public function get_name() |
| 18 |
{ |
| 19 |
return 'uicore-testimonial-slider'; |
| 20 |
} |
| 21 |
public function get_title() |
| 22 |
{ |
| 23 |
return esc_html__('Testimonial Slider', 'uicore-elements'); |
| 24 |
} |
| 25 |
public function get_icon() |
| 26 |
{ |
| 27 |
return 'eicon-testimonial ui-e-widget'; |
| 28 |
} |
| 29 |
public function get_keywords() |
| 30 |
{ |
| 31 |
return ['testimonial', 'review', 'services', 'cards', 'box', 'client', 'slider']; |
| 32 |
} |
| 33 |
public function get_styles() |
| 34 |
{ |
| 35 |
$styles = [ |
| 36 |
'testimonial-slider', |
| 37 |
'animation', // hover animations |
| 38 |
'entrance', // entrance basic style |
| 39 |
]; |
| 40 |
if(!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')){ |
| 41 |
$styles['e-animations'] = [ // entrance animations |
| 42 |
'external' => true, |
| 43 |
]; |
| 44 |
} |
| 45 |
return $styles; |
| 46 |
} |
| 47 |
protected function register_controls() { |
| 48 |
|
| 49 |
parent::register_controls(); // keep original controls |
| 50 |
|
| 51 |
// Control Updates |
| 52 |
$this->update_control('h_alignment', ['default' => 'center']); |
| 53 |
// Default avatar size with one slide visible per time is too big, needs a decrease |
| 54 |
$this->update_control( 'avatar_size', |
| 55 |
[ |
| 56 |
'devices' => ['desktop', 'tablet', 'mobile'], |
| 57 |
'default' => [ |
| 58 |
'size' => 10, |
| 59 |
'unit' => '%' |
| 60 |
], |
| 61 |
'tablet_default' => [ |
| 62 |
'size' => 15, |
| 63 |
'unit' => '%' |
| 64 |
], |
| 65 |
'mobile_default' => [ |
| 66 |
'size' => 40, |
| 67 |
'unit' => '%' |
| 68 |
], |
| 69 |
] |
| 70 |
); |
| 71 |
// Change default border radius to zero |
| 72 |
$this->update_control( 'item_border_radius', [ |
| 73 |
'default' => [ |
| 74 |
'top' => 0, |
| 75 |
'right' => 0, |
| 76 |
'bottom' => 0, |
| 77 |
'left' => 0, |
| 78 |
'unit' => 'px', |
| 79 |
'isLinked' => true, |
| 80 |
], |
| 81 |
]); |
| 82 |
// Add special animation slide |
| 83 |
$this->update_control('animation_style',[ |
| 84 |
'default' => 'fade', |
| 85 |
'options' => [ |
| 86 |
'coverflow' => esc_html__('Coverflow', 'uicore-elements'), |
| 87 |
'fade' => esc_html__('Fade', 'uicore-elements'), |
| 88 |
'cards' => esc_html__('Cards', 'uicore-elements'), |
| 89 |
'flip' => esc_html__('Flip', 'uicore-elements'), |
| 90 |
'creative' => esc_html__('Creative', 'uicore-elements'), |
| 91 |
] |
| 92 |
]); |
| 93 |
|
| 94 |
// Remove item entrance and hover animation |
| 95 |
$this->remove_control('animate_items'); |
| 96 |
$this->remove_control('item_hover_animation'); |
| 97 |
|
| 98 |
// Remove controls that are meant for carousel, not slide type widgets |
| 99 |
$this->remove_responsive_control('slides_per_view'); |
| 100 |
$this->remove_control('show_hidden'); |
| 101 |
$this->remove_control('fade_edges'); |
| 102 |
$this->remove_control('fade_edges_alert'); |
| 103 |
$this->remove_control('match_height'); |
| 104 |
$this->remove_control('carousel_gap'); |
| 105 |
} |
| 106 |
} |
| 107 |
\Elementor\Plugin::instance()->widgets_manager->register(new TestimonialSlider()); |