PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.0.14
UiCore Elements – Free widgets and templates for Elementor v1.0.14
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.0.14, at includes/widgets/gallery-carousel.php

259 lines 8.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
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 '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 return $this->TRAIT_get_carousel_scripts();
66 }
67 protected function register_controls()
68 {
69 $this->TRAIT_register_gallery_repeater_controls('Content');
70 $this->TRAIT_register_additional_controls(true);
71
72 $this->start_controls_section(
73 'carousel_section',
74 [
75 'label' => esc_html__('Carousel Settings', 'uicore-elements'),
76 'tab' => Controls_Manager::TAB_CONTENT,
77 ]
78 );
79 $this->TRAIT_register_carousel_additional_controls();
80 $this->add_control(
81 'divider',
82 [
83 'type' => Controls_Manager::DIVIDER,
84 ]
85 );
86 $this->TRAIT_register_carousel_settings_controls();
87
88 $this->end_controls_section();
89
90 $this->TRAIT_register_navigation_controls();
91
92 $this->start_controls_section(
93 'items_style_section',
94 [
95 'label' => esc_html__('Item', 'uicore-elements'),
96 'tab' => Controls_Manager::TAB_STYLE,
97 ]
98 );
99
100 $this->TRAIT_register_all_item_style_controls();
101
102 $this->end_controls_section();
103
104 $this->TRAIT_register_filters_style_controls();
105 $this->TRAIT_register_image_style_controls(true);
106 $this->TRAIT_register_title_style_controls();
107 $this->TRAIT_register_description_style_controls();
108 $this->TRAIT_register_tags_style_controls();
109 $this->TRAIT_register_badge_style_controls();
110 $this->TRAIT_register_navigation_style_controls();
111 $this->TRAIT_register_gallery_animations();
112
113 // Update some component controls
114 $this->update_control(
115 'item_border_border',
116 [
117 'default' => 'none'
118 ]
119 );
120 $this->update_control(
121 'item_padding',
122 [
123 'default' => [
124 'top' => 10,
125 'right' => 10,
126 'bottom' => 10,
127 'left' => 10,
128 ],
129 'selectors' => [
130 '{{WRAPPER}} .ui-e-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
131 ],
132 ]
133 );
134 $this->update_control(
135 'item_border_radius',
136 [
137 'default' => [
138 'top' => 0,
139 'right' => 0,
140 'bottom' => 0,
141 'left' => 0,
142 'unit' => 'px',
143 ]
144 ]
145 );
146 $this->update_control(
147 'match_height', [
148 'render_type' => 'template',
149 ]
150 );
151
152 // Remove some useless component controls or group controls that can't be properly updated
153 $this->remove_control('item_background_background');
154 $this->remove_control('item_hover_background_background');
155 $this->remove_control('item_background_color');
156 $this->remove_control('item_background_image');
157 $this->remove_control('item_background_gradient');
158
159 // Inject new controls
160 // TODO: release this feature after fixing compatibility issues with `fade_blur` and `circular`
161 // $this->start_injection([
162 // 'of' => 'animation_style',
163 // 'at' => 'after',
164 // ]);
165
166 // $this->add_control(
167 // 'main_image',
168 // [
169 // 'label' => __('Main image', 'uicore-elements'),
170 // 'type' => Controls_Manager::SELECT,
171 // 'default' => '',
172 // 'options' => [
173 // '' => esc_html__('Default', 'uicore-elements'),
174 // 'ui-e-main-image-scale' => esc_html__('Scale', 'uicore-elements'),
175 // 'ui-e-main-image-show' => esc_html__('Show Info', 'uicore-elements'),
176 // 'ui-e-main-image-show_scale' => esc_html__('Show Info & Scale', 'uicore-elements'),
177 // ],
178 // 'prefix_class' => '',
179 // 'render_type' => 'template',
180 // 'frontend_available' => true,
181 // ]
182 // );
183
184 // $this->end_injection();
185
186 $this->start_injection([
187 'of' => 'item_border_border',
188 'at' => 'before',
189 ]);
190
191 // normal background controls
192 $this->add_group_control(
193 Group_Control_Background::get_type(),
194 [
195 'name' => 'item_gallery_background',
196 'selector' => '{{WRAPPER}} .ui-e-item',
197 'condition' => [
198 'layout' => '',
199 ]
200 ]
201 );
202 $this->add_group_control(
203 Group_Control_Background::get_type(),
204 [
205 'name' => 'item_content_background',
206 'selector' => '{{WRAPPER}} .ui-e-content',
207 'condition' => [
208 'layout' => 'ui-e-overlay',
209 ]
210 ]
211 );
212
213 $this->end_injection();
214
215 $this->start_injection([
216 'of' => 'item_hover_border_color',
217 'at' => 'before',
218 ]);
219
220 // hover background controls
221 $this->add_group_control(
222 Group_Control_Background::get_type(),
223 [
224 'name' => 'item_gallery_hover_background',
225 'selector' => '{{WRAPPER}} .ui-e-item:hover',
226 'condition' => [
227 'layout' => '',
228 ]
229 ]
230 );
231 $this->add_group_control(
232 Group_Control_Background::get_type(),
233 [
234 'name' => 'item_content_hover_background',
235 'selector' => '{{WRAPPER}} .ui-e-item:hover .ui-e-content',
236 'condition' => [
237 'layout' => 'ui-e-overlay',
238 ]
239 ]
240 );
241
242 $this->end_injection();
243 }
244
245 public function render()
246 {
247 $settings = $this->get_settings_for_display();
248 ?>
249 <div class="ui-e-carousel swiper">
250 <div class='swiper-wrapper'>
251 <?php $this->TRAIT_render_gallery($settings, true); ?>
252 </div>
253 <?php $this->TRAIT_render_carousel_navigations(); ?>
254 </div>
255 <?php
256 }
257
258 }
259 \Elementor\Plugin::instance()->widgets_manager->register(new GalleryCarousel());