PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.2.3
UiCore Elements – Free widgets and templates for Elementor v1.2.3
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 / gallery-carousel.php

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

264 lines 8.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace UiCoreElements;
3
4 use Elementor\Controls_Manager;
5 use Elementor\Group_Control_Background;
6
7 use UiCoreElements\UiCoreWidget;
8 use UiCoreElements\Utils\Animation_Trait;
9 use UiCoreElements\Utils\Gallery_Trait;
10 use UiCoreElements\Utils\Carousel_Trait;
11 use UicoreElements\Utils\Item_Style_Component;
12
13 defined('ABSPATH') || exit();
14
15 /**
16 * Gallery Carousel
17 *
18 * @author Lucas Marini Falbo <lucas95@uicore.co>
19 * @since 1.0.14
20 */
21
22 class GalleryCarousel extends UiCoreWidget
23 {
24 use Animation_Trait;
25 use Gallery_Trait;
26 use Carousel_Trait;
27 use Item_Style_Component;
28
29 public function get_name()
30 {
31 return 'uicore-gallery-carousel';
32 }
33 public function get_title()
34 {
35 return esc_html__('Gallery Carousel', 'uicore-elements');
36 }
37 public function get_icon()
38 {
39 return 'eicon-carousel-loop ui-e-widget';
40 }
41 public function get_categories()
42 {
43 return ['uicore'];
44 }
45 public function get_keywords()
46 {
47 return ['gallery', 'carousel', 'slides', 'content', 'box'];
48 }
49 public function get_styles()
50 {
51 $styles = [
52 'gallery-carousel',
53 'carousel',
54 'animation', // hover animations
55 'entrance', // entrance basic style
56 ];
57 if(!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')){
58 $styles['e-animations'] = [ // entrance animations
59 'external' => true,
60 ];
61 }
62 return $styles;
63 }
64 public function get_scripts()
65 {
66 return $this->TRAIT_get_carousel_scripts();
67 }
68 public function has_widget_inner_wrapper(): bool {
69 // TODO: remove after 3.30, when the full deprecation of widget innet wrapper is ready
70 return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
71 }
72 protected function register_controls()
73 {
74 $this->TRAIT_register_gallery_repeater_controls('Content');
75 $this->TRAIT_register_additional_controls(true);
76
77 $this->start_controls_section(
78 'carousel_section',
79 [
80 'label' => esc_html__('Carousel Settings', 'uicore-elements'),
81 'tab' => Controls_Manager::TAB_CONTENT,
82 ]
83 );
84 $this->TRAIT_register_carousel_additional_controls();
85 $this->add_control(
86 'divider',
87 [
88 'type' => Controls_Manager::DIVIDER,
89 ]
90 );
91 $this->TRAIT_register_carousel_settings_controls();
92
93 $this->end_controls_section();
94
95 $this->TRAIT_register_navigation_controls();
96
97 $this->start_controls_section(
98 'items_style_section',
99 [
100 'label' => esc_html__('Item', 'uicore-elements'),
101 'tab' => Controls_Manager::TAB_STYLE,
102 ]
103 );
104
105 $this->TRAIT_register_all_item_style_controls();
106
107 $this->end_controls_section();
108
109 $this->TRAIT_register_filters_style_controls();
110 $this->TRAIT_register_image_style_controls(true);
111 $this->TRAIT_register_title_style_controls();
112 $this->TRAIT_register_description_style_controls();
113 $this->TRAIT_register_tags_style_controls();
114 $this->TRAIT_register_badge_style_controls();
115 $this->TRAIT_register_navigation_style_controls();
116 $this->TRAIT_register_gallery_animations();
117
118 // Update some component controls
119 $this->update_control(
120 'item_border_border',
121 [
122 'default' => 'none'
123 ]
124 );
125 $this->update_control(
126 'item_padding',
127 [
128 'default' => [
129 'top' => 10,
130 'right' => 10,
131 'bottom' => 10,
132 'left' => 10,
133 ],
134 'selectors' => [
135 '{{WRAPPER}} .ui-e-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
136 ],
137 ]
138 );
139 $this->update_control(
140 'item_border_radius',
141 [
142 'default' => [
143 'top' => 0,
144 'right' => 0,
145 'bottom' => 0,
146 'left' => 0,
147 'unit' => 'px',
148 ]
149 ]
150 );
151 $this->update_control(
152 'match_height', [
153 'render_type' => 'template',
154 ]
155 );
156
157 // Remove some useless component controls or group controls that can't be properly updated
158 $this->remove_control('item_background_background');
159 $this->remove_control('item_hover_background_background');
160 $this->remove_control('item_background_color');
161 $this->remove_control('item_background_image');
162 $this->remove_control('item_background_gradient');
163
164 // Inject new controls
165 $this->start_injection([
166 'of' => 'animation_style',
167 'at' => 'after',
168 ]);
169
170 $this->add_control(
171 'main_image',
172 [
173 'label' => __('Main image', 'uicore-elements'),
174 'type' => Controls_Manager::SELECT,
175 'default' => '',
176 'options' => [
177 '' => esc_html__('Default', 'uicore-elements'),
178 'ui-e-main-image-scale' => esc_html__('Scale', 'uicore-elements'),
179 'ui-e-main-image-show' => esc_html__('Show Info', 'uicore-elements'),
180 'ui-e-main-image-show_scale' => esc_html__('Show Info & Scale', 'uicore-elements'),
181 ],
182 'description' => __('Works best with centered slides.', 'uicore-elements'),
183 'prefix_class' => '',
184 'render_type' => 'template',
185 'frontend_available' => true,
186 ]
187 );
188
189 $this->end_injection();
190
191 $this->start_injection([
192 'of' => 'item_border_border',
193 'at' => 'before',
194 ]);
195
196 // normal background controls
197 $this->add_group_control(
198 Group_Control_Background::get_type(),
199 [
200 'name' => 'item_gallery_background',
201 'selector' => '{{WRAPPER}} .ui-e-item',
202 'condition' => [
203 'layout' => '',
204 ]
205 ]
206 );
207 $this->add_group_control(
208 Group_Control_Background::get_type(),
209 [
210 'name' => 'item_content_background',
211 'selector' => '{{WRAPPER}} .ui-e-content',
212 'condition' => [
213 'layout' => 'ui-e-overlay',
214 ]
215 ]
216 );
217
218 $this->end_injection();
219
220 $this->start_injection([
221 'of' => 'item_hover_border_color',
222 'at' => 'before',
223 ]);
224
225 // hover background controls
226 $this->add_group_control(
227 Group_Control_Background::get_type(),
228 [
229 'name' => 'item_gallery_hover_background',
230 'selector' => '{{WRAPPER}} .ui-e-item:hover',
231 'condition' => [
232 'layout' => '',
233 ]
234 ]
235 );
236 $this->add_group_control(
237 Group_Control_Background::get_type(),
238 [
239 'name' => 'item_content_hover_background',
240 'selector' => '{{WRAPPER}} .ui-e-item:hover .ui-e-content',
241 'condition' => [
242 'layout' => 'ui-e-overlay',
243 ]
244 ]
245 );
246
247 $this->end_injection();
248 }
249
250 public function render()
251 {
252 $settings = $this->get_settings_for_display();
253 ?>
254 <div class="ui-e-carousel swiper">
255 <div class='swiper-wrapper'>
256 <?php $this->TRAIT_render_gallery($settings, true); ?>
257 </div>
258 </div>
259 <?php $this->TRAIT_render_carousel_navigations(); ?>
260 <?php
261 }
262
263 }
264 \Elementor\Plugin::instance()->widgets_manager->register(new GalleryCarousel());