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

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