PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.0.5
UiCore Elements – Free widgets and templates for Elementor v1.0.5
1.3.17 1.3.16 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 All 41 releases
uicore-elements / includes / widgets / testimonial-carousel.php

testimonial-carousel.php in UiCore Elements – Free widgets and templates for Elementor 1.0.5, at includes/widgets/testimonial-carousel.php

227 lines 7.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace UiCoreElements;
3 use Elementor\Controls_Manager;
4 use UiCoreElements\UiCoreWidget;
5 use UiCoreElements\Utils\Carousel_Trait;
6 use UiCoreElements\Utils\Testimonial_Trait;
7 use UiCoreElements\Utils\Animation_Trait;
8 use UiCoreElements\Utils\Item_Style_Component;
9
10 defined('ABSPATH') || exit();
11
12 /**
13 * Testimonial Carousel
14 *
15 * @author Lucas Marini Falbo <lucas@uicore.co>
16 * @since 1.0.1
17 */
18
19 class TestimonialCarousel extends UiCoreWidget
20 {
21
22 public $is_slider;
23
24 use Carousel_Trait;
25 use Testimonial_Trait;
26 use Animation_Trait;
27 use Item_Style_Component;
28
29 public function get_name()
30 {
31 return 'uicore-testimonial-carousel';
32 }
33 public function get_title()
34 {
35 return esc_html__('Testimonial Carousel', 'uicore-elements');
36 }
37 public function get_icon()
38 {
39 return 'eicon-testimonial ui-e-widget';
40 }
41 public function get_categories()
42 {
43 return ['uicore'];
44 }
45 public function get_keywords()
46 {
47 return ['testimonial', 'review', 'services', 'cards', 'box', 'client', 'carousel'];
48 }
49 public function get_styles()
50 {
51 $styles = [
52 'testimonial-carousel',
53 'animation', // hover animations
54 'entrance', // entrance basic style
55 ];
56 if(!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')){
57 $styles['e-animations'] = [ // entrance animations
58 'external' => true,
59 ];
60 }
61 return $styles;
62 }
63 public function get_scripts()
64 {
65 $scripts = [
66 'carousel',
67 'utils/global-testimonial' => [
68 'condition' => [
69 'layout' => 'layout_5'
70 ],
71 ],
72 'utils/carousel-effects/circular' => [
73 'condition' => [
74 'animation_style' => 'circular',
75 ]
76 ],
77 'utils/carousel-effects/fade-and-blur' => [
78 'condition' => [
79 'animation_style' => 'fade_blur',
80 ]
81 ],
82 'entrance' => [
83 'condition' => [
84 'animate_items' => 'ui-e-grid-animate'
85 ],
86 ]
87 ];
88 if($this->get_name() === 'uicore-testimonial-slider'){
89 $scripts['utils/carousel-effects/stacked'] = [
90 'condition' => [
91 'animation_style' => 'stacked',
92 ]
93 ];
94 }
95 return $scripts;
96 }
97 protected function register_controls()
98 {
99
100 $this->TRAIT_register_testimonial_repeater_controls('Testimonial Carousel Items'); // Repeater Controls
101
102 // Additional Carousel Controls
103 $this->start_controls_section(
104 'section_review_additional_settings',
105 [
106 'label' => __('Additional Settings', 'uicore-elements'),
107 'tab' => Controls_Manager::TAB_CONTENT,
108 ]
109 );
110
111 $this->TRAIT_register_specific_testimonial_controls('layout');
112 $this->TRAIT_register_carousel_additional_controls(); // Carousel Additionals
113 $this->TRAIT_register_testimonial_additional_controls(); // Testimonial Additionals
114
115 $this->end_controls_section();
116
117 $this->start_controls_section(
118 'section_carousel_settings',
119 [
120 'label' => __('Carousel Settings', 'uicore-elements'),
121 ]
122 );
123
124 $this->TRAIT_register_carousel_settings_controls(); // Carousel settings
125
126 $this->end_controls_section();
127
128 $this->TRAIT_register_navigation_controls(); // Navigation settings
129
130 $this->start_controls_section(
131 'section_style_review_items',
132 [
133 'label' => esc_html__( 'Items', 'uicore-elements' ),
134 'tab' => Controls_Manager::TAB_STYLE,
135 ]
136 );
137
138 // move it to specific controls
139 $this->add_control(
140 'item_gap',
141 [
142 'label' => esc_html__( 'Inner Content Spacing', 'uicore-elements' ),
143 'type' => Controls_Manager::SLIDER,
144 'size_units' => [ 'px', '%', 'em' ],
145 'range' => [
146 'px' => [
147 'min' => 0,
148 'max' => 50,
149 'step' => 1,
150 ],
151 '%' => [
152 'min' => 0,
153 'max' => 100,
154 ],
155 ],
156 'default' => [
157 'unit' => 'px',
158 'size' => 15,
159 ],
160 'selectors' => [
161 '{{WRAPPER}} .ui-e-testimonial-flex' => 'margin-bottom: {{SIZE}}{{UNIT}};',
162 ],
163 'conditions' => [
164 'relation' => 'and',
165 'terms' => [
166 [
167 'name' => 'image_inline',
168 'operator' => '===',
169 'value' => 'yes',
170 ],
171 [
172 'name' => 'layout',
173 'operator' => 'in',
174 'value' => ['layout_2'],
175 ],
176 ],
177 ],
178 ]
179 );
180 $this->TRAIT_register_all_item_style_controls();
181
182 $this->end_controls_section();
183
184 $this->TRAIT_register_style_controls(); // All Testimonial components styles
185 $this->TRAIT_register_navigation_style_controls(); // Carousel Navigation Styles
186
187 $this->start_controls_section(
188 'section_style_animations',
189 [
190 'label' => __('Animations', 'uicore-elements'),
191 'tab' => Controls_Manager::TAB_STYLE,
192 ]
193 );
194
195 $this->TRAIT_register_testimonial_animation_controls();
196
197 $this->end_controls_section();
198
199 // We need to set border radius as variable to use item radius on other components on swiper elements
200 $this->update_control('item_border_radius', [
201 'selectors' => [
202 '{{WRAPPER}} .ui-e-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
203 '{{WRAPPER}}' => '--ui-e-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
204 ],
205 ]);
206 }
207 public function render()
208 {
209 $ID = $this->get_ID();
210 $settings = $this->get_settings_for_display();
211
212 $this->add_render_attribute('review-carousel', 'class', ['swiper-wrapper', "carousel-$ID"]);
213 ?>
214 <div class="ui-e-carousel swiper">
215 <div class='swiper-wrapper'>
216 <?php
217 foreach ( $settings['review_items'] as $index => $item ) :
218 $this->TRAIT_render_review_item($item, $settings['layout']);
219 endforeach;
220 ?>
221 </div>
222 <?php $this->TRAIT_render_carousel_navigations(); ?>
223 </div>
224 <?php
225 }
226 }
227 \Elementor\Plugin::instance()->widgets_manager->register(new TestimonialCarousel());