PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.3.17
UiCore Elements – Free widgets and templates for Elementor v1.3.17
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
← All changes | includes/utils/logo-component.php +324 -306 1.0.61.3.17 View file →
@@ -1,5 +1,6 @@
1 1 <?php
2 +
2 3 namespace UiCoreElements\Utils;
3 4
4 5 use Elementor\Controls_Manager;
5 6 use Elementor\Utils;
@@ -7,96 +8,103 @@
7 8 use Elementor\Group_Control_Image_Size;
8 9 use Elementor\Group_Control_Box_Shadow;
9 10 use Elementor\Group_Control_Css_Filter;
10 11
12 +use UiCoreElements\Utils\Carousel_Trait;
13 +use UiCoreElements\Helper;
14 +
11 15 defined('ABSPATH') || exit();
12 16
13 -trait Logo_Trait {
17 +trait Logo_Trait
18 +{
14 19
20 + use Carousel_Trait;
21 +
15 22 // Settings
16 - function TRAIT_register_logo_repeater_controls($logo)
23 + protected function TRAIT_register_logo_repeater_controls($logo)
17 24 {
18 25 $this->start_controls_section(
19 26 'section_logo',
20 27 [
21 - 'label' => __( $logo, 'uicore-elements' ),
28 + /* translators: %s: logo name */
29 + 'label' => esc_html(sprintf('%s', $logo), 'uicore-elements'),
22 30 'tab' => Controls_Manager::TAB_CONTENT,
23 31 ]
24 32 );
25 33
26 - $repeater = new Repeater();
27 - $repeater->add_control(
28 - 'title',
29 - [
30 - 'label' => __( 'Title', 'uicore-elements' ),
31 - 'type' => Controls_Manager::TEXT,
32 - ]
33 - );
34 - $repeater->add_control(
35 - 'image',
36 - [
37 - 'label' => __( 'Logo Image', 'uicore-elements' ),
38 - 'type' => Controls_Manager::MEDIA,
39 - 'default' => [
40 - 'url' => Utils::get_placeholder_image_src(),
34 + $repeater = new Repeater();
35 + $repeater->add_control(
36 + 'title',
37 + [
38 + 'label' => esc_html__('Title', 'uicore-elements'),
39 + 'type' => Controls_Manager::TEXT,
40 + ]
41 + );
42 + $repeater->add_control(
43 + 'image',
44 + [
45 + 'label' => esc_html__('Logo Image', 'uicore-elements'),
46 + 'type' => Controls_Manager::MEDIA,
47 + 'default' => [
48 + 'url' => Utils::get_placeholder_image_src(),
49 + ],
50 + ]
51 + );
52 + $repeater->add_control(
53 + 'link',
54 + [
55 + 'label' => esc_html__('Website URL', 'uicore-elements'),
56 + 'type' => Controls_Manager::URL,
57 + 'show_external' => false,
58 + 'label_block' => false,
59 + ]
60 + );
61 + $this->add_control(
62 + 'logo_list',
63 + [
64 + 'show_label' => false,
65 + 'type' => Controls_Manager::REPEATER,
66 + 'fields' => $repeater->get_controls(),
67 + 'title_field' => "{{{ title }}}",
68 + 'default' => [
69 + [
70 + 'title' => esc_html__('Item 1', 'uicore-elements'),
71 + 'image' => ['url' => Utils::get_placeholder_image_src()]
41 72 ],
73 + [
74 + 'title' => esc_html__('Item 2', 'uicore-elements'),
75 + 'image' => ['url' => Utils::get_placeholder_image_src()]
76 + ],
77 + [
78 + 'title' => esc_html__('Item 3', 'uicore-elements'),
79 + 'image' => ['url' => Utils::get_placeholder_image_src()]
80 + ],
81 + [
82 + 'title' => esc_html__('Item 4', 'uicore-elements'),
83 + 'image' => ['url' => Utils::get_placeholder_image_src()]
84 + ],
85 + [
86 + 'title' => esc_html__('Item 5', 'uicore-elements'),
87 + 'image' => ['url' => Utils::get_placeholder_image_src()]
88 + ],
89 + [
90 + 'title' => esc_html__('Item 6', 'uicore-elements'),
91 + 'image' => ['url' => Utils::get_placeholder_image_src()]
92 + ],
93 + [
94 + 'title' => esc_html__('Item 7', 'uicore-elements'),
95 + 'image' => ['url' => Utils::get_placeholder_image_src()]
96 + ],
97 + [
98 + 'title' => esc_html__('Item 8', 'uicore-elements'),
99 + 'image' => ['url' => Utils::get_placeholder_image_src()]
100 + ],
42 101 ]
43 - );
44 - $repeater->add_control(
45 - 'link',
46 - [
47 - 'label' => __( 'Website URL', 'uicore-elements' ),
48 - 'type' => Controls_Manager::URL,
49 - 'show_external' => false,
50 - 'label_block' => false,
51 - ]
52 - );
53 - $this->add_control(
54 - 'logo_list',
55 - [
56 - 'show_label' => false,
57 - 'type' => Controls_Manager::REPEATER,
58 - 'fields' => $repeater->get_controls(),
59 - 'title_field' => "{{{ title }}}",
60 - 'default' => [
61 - [
62 - 'title' => __( 'Item 1', 'uicore-elements' ),
63 - 'image' => [ 'url' => Utils::get_placeholder_image_src() ]
64 - ],
65 - [
66 - 'title' => __( 'Item 2', 'uicore-elements' ),
67 - 'image' => [ 'url' => Utils::get_placeholder_image_src() ]
68 - ],
69 - [
70 - 'title' => __( 'Item 3', 'uicore-elements' ),
71 - 'image' => [ 'url' => Utils::get_placeholder_image_src() ]
72 - ],
73 - [
74 - 'title' => __( 'Item 4', 'uicore-elements' ),
75 - 'image' => [ 'url' => Utils::get_placeholder_image_src() ]
76 - ],
77 - [
78 - 'title' => __( 'Item 5', 'uicore-elements' ),
79 - 'image' => [ 'url' => Utils::get_placeholder_image_src() ]
80 - ],
81 - [
82 - 'title' => __( 'Item 6', 'uicore-elements' ),
83 - 'image' => [ 'url' => Utils::get_placeholder_image_src() ]
84 - ],
85 - [
86 - 'title' => __( 'Item 7', 'uicore-elements' ),
87 - 'image' => [ 'url' => Utils::get_placeholder_image_src() ]
88 - ],
89 - [
90 - 'title' => __( 'Item 8', 'uicore-elements' ),
91 - 'image' => [ 'url' => Utils::get_placeholder_image_src() ]
92 - ],
93 - ]
94 - ]
95 - );
102 + ]
103 + );
96 104 $this->end_controls_section();
97 105 }
98 - function TRAIT_register_logo_adittional_controls()
106 + protected function TRAIT_register_logo_adittional_controls()
99 107 {
100 108 $this->add_group_control(
101 109 Group_Control_Image_Size::get_type(),
102 110 [
@@ -110,11 +118,11 @@
110 118 );
111 119 $this->add_responsive_control(
112 120 'height',
113 121 [
114 - 'label' => __( 'Item Height', 'uicore-elements' ),
122 + 'label' => esc_html__('Item Height', 'uicore-elements'),
115 123 'type' => Controls_Manager::SLIDER,
116 - 'size_units' => [ 'px' ],
124 + 'size_units' => ['px'],
117 125 'range' => [
118 126 'px' => [
119 127 'max' => 500,
120 128 'min' => 100,
@@ -127,202 +135,202 @@
127 135 );
128 136 }
129 137
130 138 // Grid Styles
131 - function TRAIT_register_logos_grid_style_controls()
139 + protected function TRAIT_register_logos_grid_style_controls()
132 140 {
133 - $this->start_controls_tabs( 'logos_style' );
141 + $this->start_controls_tabs('logos_style');
134 142
135 - $this->start_controls_tab(
136 - 'tab_logos_style_normal',
137 - [
138 - 'label' => __( 'Normal', 'uicore-elements' ),
143 + $this->start_controls_tab(
144 + 'tab_logos_style_normal',
145 + [
146 + 'label' => esc_html__('Normal', 'uicore-elements'),
147 + ]
148 + );
149 +
150 + $this->add_control(
151 + 'item_bg_color',
152 + [
153 + 'label' => esc_html__('Background Color', 'uicore-elements'),
154 + 'type' => Controls_Manager::COLOR,
155 + 'selectors' => [
156 + '{{WRAPPER}} figure' => 'background-color: {{VALUE}};',
157 + ],
158 + ]
159 + );
160 + // Using Group Control Border overlays script border styling
161 + $this->add_control(
162 + 'item_border_type',
163 + [
164 + 'label' => esc_html__('Border Type', 'uicore-elements'),
165 + 'type' => Controls_Manager::SELECT,
166 + 'options' => [
167 + 'none' => esc_html__('None', 'uicore-elements'),
168 + 'solid' => esc_html__('Solid', 'uicore-elements'),
169 + 'double' => esc_html__('Double', 'uicore-elements'),
170 + 'dotted' => esc_html__('Dotted', 'uicore-elements'),
171 + 'dashed' => esc_html__('Dashed', 'uicore-elements'),
172 + 'groove' => esc_html__('Groove', 'uicore-elements'),
173 + ],
174 + 'default' => 'solid',
175 + 'selectors' => [
176 + '{{WRAPPER}} .ui-e-item' => 'border-style: {{VALUE}};',
177 + ],
178 + ]
179 + );
180 + $this->add_responsive_control(
181 + 'item_border_width',
182 + [
183 + 'label' => esc_html__('Border Width', 'uicore-elements'),
184 + 'type' => Controls_Manager::SLIDER,
185 + 'default' => [
186 + 'size' => 2,
187 + ],
188 + 'tablet_default' => [
189 + 'size' => 2,
190 + ],
191 + 'mobile_default' => [
192 + 'size' => 2,
193 + ],
194 + 'range' => [
195 + 'px' => [
196 + 'min' => 0,
197 + 'max' => 50,
198 + ],
199 + ],
200 + 'selectors' => [
201 + '{{WRAPPER}}' => '--ui-e-border-width: {{SIZE}}{{UNIT}};'
202 + ],
203 + 'condition' => [
204 + 'item_border_type!' => 'none',
139 205 ]
140 - );
141 -
142 - $this->add_control(
143 - 'item_bg_color',
144 - [
145 - 'label' => __( 'Background Color', 'uicore-elements' ),
146 - 'type' => Controls_Manager::COLOR,
147 - 'selectors' => [
148 - '{{WRAPPER}} figure' => 'background-color: {{VALUE}};',
149 - ],
150 - ]
151 - );
152 - // Using Group Control Border overlays script border styling
153 - $this->add_control(
154 - 'item_border_type',
155 - [
156 - 'label' => __( 'Border Type', 'bdthemes-element-pack' ),
157 - 'type' => Controls_Manager::SELECT,
158 - 'options' => [
159 - 'none' => __( 'None', 'bdthemes-element-pack' ),
160 - 'solid' => __( 'Solid', 'bdthemes-element-pack' ),
161 - 'double' => __( 'Double', 'bdthemes-element-pack' ),
162 - 'dotted' => __( 'Dotted', 'bdthemes-element-pack' ),
163 - 'dashed' => __( 'Dashed', 'bdthemes-element-pack' ),
164 - 'groove' => __( 'Groove', 'bdthemes-element-pack' ),
165 - ],
166 - 'default' => 'solid',
167 - 'selectors' => [
168 - '{{WRAPPER}} .ui-e-item' => 'border-style: {{VALUE}};',
169 - ],
170 - ]
171 - );
172 - $this->add_responsive_control(
173 - 'item_border_width',
174 - [
175 - 'label' => __( 'Border Width', 'bdthemes-element-pack' ),
176 - 'type' => Controls_Manager::SLIDER,
177 - 'default' => [
178 - 'size' => 2,
179 - ],
180 - 'tablet_default' => [
181 - 'size' => 2,
182 - ],
183 - 'mobile_default' => [
184 - 'size' => 2,
185 - ],
186 - 'range' => [
187 - 'px' => [
188 - 'min' => 0,
189 - 'max' => 50,
190 - ],
191 - ],
192 - 'selectors' => [
193 - '{{WRAPPER}}' => '--ui-e-border-width: {{SIZE}}{{UNIT}};'
194 - ],
195 - 'condition' => [
196 - 'item_border_type!' => 'none',
197 - ]
198 - ]
199 - );
200 - $this->add_control(
201 - 'item_border_color',
202 - [
203 - 'label' => __( 'Border Color', 'bdthemes-element-pack' ),
204 - 'type' => Controls_Manager::COLOR,
205 - 'selectors' => [
206 - '{{WRAPPER}} .ui-e-item' => 'border-color: {{VALUE}};',
207 - ],
208 - 'default' => '#EEE',
209 - 'condition' => [
210 - 'item_border_type!' => 'none',
211 - ]
212 - ]
213 - );
214 - $this->add_responsive_control(
215 - 'item_border_radius',
216 - [
217 - 'label' => __( 'Border Radius', 'uicore-elements' ),
218 - 'type' => Controls_Manager::DIMENSIONS,
219 - 'size_units' => [ 'px', '%' ],
220 - 'default' => [
221 - 'top' => 5,
222 - 'right' => 5,
223 - 'bottom' => 5,
224 - 'left' => 5,
225 - 'unit' => 'px',
226 - 'isLinked' => true,
227 - ],
228 - 'selectors' => [
229 - // each side is used separately by logo-grid script
230 - '{{WRAPPER}}' => '--ui-e-top-radius: {{TOP}}{{UNIT}};
206 + ]
207 + );
208 + $this->add_control(
209 + 'item_border_color',
210 + [
211 + 'label' => esc_html__('Border Color', 'uicore-elements'),
212 + 'type' => Controls_Manager::COLOR,
213 + 'selectors' => [
214 + '{{WRAPPER}} .ui-e-item' => 'border-color: {{VALUE}};',
215 + ],
216 + 'default' => '#EEE',
217 + 'condition' => [
218 + 'item_border_type!' => 'none',
219 + ]
220 + ]
221 + );
222 + $this->add_responsive_control(
223 + 'item_border_radius',
224 + [
225 + 'label' => esc_html__('Border Radius', 'uicore-elements'),
226 + 'type' => Controls_Manager::DIMENSIONS,
227 + 'size_units' => ['px', '%'],
228 + 'default' => [
229 + 'top' => 5,
230 + 'right' => 5,
231 + 'bottom' => 5,
232 + 'left' => 5,
233 + 'unit' => 'px',
234 + 'isLinked' => true,
235 + ],
236 + 'selectors' => [
237 + // each side is used separately by logo-grid script
238 + '{{WRAPPER}}' => '--ui-e-top-radius: {{TOP}}{{UNIT}};
231 239 --ui-e-right-radius: {{RIGHT}}{{UNIT}};
232 240 --ui-e-left-radius: {{LEFT}}{{UNIT}};
233 241 --ui-e-bottom-radius: {{BOTTOM}}{{UNIT}};
234 242 --ui-e-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
235 - ],
236 - ]
237 - );
238 - $this->add_responsive_control(
239 - 'item_padding',
240 - [
241 - 'label' => __( 'Padding', 'uicore-elements' ),
242 - 'type' => Controls_Manager::DIMENSIONS,
243 - 'size_units' => [ 'px', 'em', '%' ],
244 - 'default' => [
245 - 'top' => 20,
246 - 'right' => 20,
247 - 'bottom' => 20,
248 - 'left' => 20,
249 - 'unit' => 'px',
250 - 'isLinked' => true,
251 - ],
252 - 'selectors' => [
253 - '{{WRAPPER}} figure' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
254 - ],
255 - ]
256 - );
257 - $this->add_group_control(
258 - Group_Control_Box_Shadow::get_type(),
259 - [
260 - 'name' => 'logos_box_shadow_item',
261 - 'exclude' => [
262 - 'box_shadow_position',
263 - ],
264 - 'selector' => '{{WRAPPER}} .ui-e-item',
265 - 'condition' => [
266 - 'layout' => 'inner-border'
267 - ],
268 - ]
269 - );
270 - $this->add_group_control(
271 - Group_Control_Box_Shadow::get_type(),
272 - [
273 - 'name' => 'logos_box_shadow_wrapper',
274 - 'exclude' => [
275 - 'box_shadow_position',
276 - ],
277 - 'selector' => '{{WRAPPER}} .ui-e-grid',
278 - 'condition' => [
279 - 'layout!' => 'inner-border'
280 - ],
281 - ]
282 - );
283 - $this->TRAIT_register_logos_image_style_controls('normal');
284 - $this->end_controls_tab();
243 + ],
244 + ]
245 + );
246 + $this->add_responsive_control(
247 + 'item_padding',
248 + [
249 + 'label' => esc_html__('Padding', 'uicore-elements'),
250 + 'type' => Controls_Manager::DIMENSIONS,
251 + 'size_units' => ['px', 'em', '%'],
252 + 'default' => [
253 + 'top' => 20,
254 + 'right' => 20,
255 + 'bottom' => 20,
256 + 'left' => 20,
257 + 'unit' => 'px',
258 + 'isLinked' => true,
259 + ],
260 + 'selectors' => [
261 + '{{WRAPPER}} figure' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
262 + ],
263 + ]
264 + );
265 + $this->add_group_control(
266 + Group_Control_Box_Shadow::get_type(),
267 + [
268 + 'name' => 'logos_box_shadow_item',
269 + 'exclude' => [
270 + 'box_shadow_position',
271 + ],
272 + 'selector' => '{{WRAPPER}} .ui-e-item',
273 + 'condition' => [
274 + 'layout' => 'inner-border'
275 + ],
276 + ]
277 + );
278 + $this->add_group_control(
279 + Group_Control_Box_Shadow::get_type(),
280 + [
281 + 'name' => 'logos_box_shadow_wrapper',
282 + 'exclude' => [
283 + 'box_shadow_position',
284 + ],
285 + 'selector' => '{{WRAPPER}} .ui-e-grid',
286 + 'condition' => [
287 + 'layout!' => 'inner-border'
288 + ],
289 + ]
290 + );
291 + $this->TRAIT_register_logos_image_style_controls('normal');
292 + $this->end_controls_tab();
285 293
286 - $this->start_controls_tab(
287 - 'tab_logos_style_hover',
288 - [
289 - 'label' => __( 'Hover', 'uicore-elements' ),
294 + $this->start_controls_tab(
295 + 'tab_logos_style_hover',
296 + [
297 + 'label' => esc_html__('Hover', 'uicore-elements'),
298 + ]
299 + );
300 + $this->add_control(
301 + 'item_bg_hover_color',
302 + [
303 + 'label' => esc_html__('Background Color', 'uicore-elements'),
304 + 'type' => Controls_Manager::COLOR,
305 + 'selectors' => [
306 + '{{WRAPPER}} .ui-e-item:hover figure' => 'background-color: {{VALUE}};',
307 + ],
308 + ]
309 + );
310 + $this->add_control(
311 + 'grid_border_hover_color',
312 + [
313 + 'label' => esc_html__('Border Color', 'uicore-elements'),
314 + 'type' => Controls_Manager::COLOR,
315 + 'selectors' => [
316 + '{{WRAPPER}} .ui-e-item:hover' => 'border-color: {{VALUE}};',
317 + ],
318 + 'condition' => [
319 + 'item_border_type!' => 'none',
320 + 'layout' => 'inner-border',
290 321 ]
291 - );
292 - $this->add_control(
293 - 'item_bg_hover_color',
294 - [
295 - 'label' => __( 'Background Color', 'uicore-elements' ),
296 - 'type' => Controls_Manager::COLOR,
297 - 'selectors' => [
298 - '{{WRAPPER}} .ui-e-item:hover figure' => 'background-color: {{VALUE}};',
299 - ],
300 - ]
301 - );
302 - $this->add_control(
303 - 'grid_border_hover_color',
304 - [
305 - 'label' => __( 'Border Color', 'uicore-elements' ),
306 - 'type' => Controls_Manager::COLOR,
307 - 'selectors' => [
308 - '{{WRAPPER}} .ui-e-item:hover' => 'border-color: {{VALUE}};',
309 - ],
310 - 'condition' => [
311 - 'item_border_type!' => 'none',
312 - 'layout' => 'inner-border',
313 - ]
314 - ]
315 - );
316 - $this->TRAIT_register_logos_image_style_controls('hover');
317 - $this->end_controls_tab();
322 + ]
323 + );
324 + $this->TRAIT_register_logos_image_style_controls('hover');
325 + $this->end_controls_tab();
318 326
319 327 $this->end_controls_tabs();
320 328 }
321 329 // Logo Image Styles
322 - function TRAIT_register_logos_image_style_controls($state)
330 + protected function TRAIT_register_logos_image_style_controls($state)
323 331 {
324 - if($state == 'normal'){
332 + if ($state == 'normal') {
325 333 $this->add_group_control(
326 334 Group_Control_Css_Filter::get_type(),
327 335 [
328 336 'name' => 'image_css_filters',
@@ -331,11 +339,11 @@
331 339 );
332 340 $this->add_responsive_control(
333 341 'image_size',
334 342 [
335 - 'label' => __( 'Image Size', 'uicore-elements' ),
343 + 'label' => esc_html__('Image Size', 'uicore-elements'),
336 344 'type' => Controls_Manager::SLIDER,
337 - 'size_units' => [ 'px', '%' ],
345 + 'size_units' => ['px', '%'],
338 346 'range' => [
339 347 'px' => [
340 348 'min' => 10,
341 349 'max' => 500,
@@ -349,9 +357,9 @@
349 357 '{{WRAPPER}} img' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}}; object-fit: contain;'
350 358 ],
351 359 ]
352 360 );
353 - } else if ($state == 'hover'){
361 + } else if ($state == 'hover') {
354 362 $this->add_group_control(
355 363 Group_Control_Css_Filter::get_type(),
356 364 [
357 365 'name' => 'image_css_filters_hover',
@@ -360,9 +368,9 @@
360 368 );
361 369 $this->add_control(
362 370 'image_bg_hover_transition',
363 371 [
364 - 'label' => __( 'Transition Duration', 'uicore-elements' ),
372 + 'label' => esc_html__('Transition Duration', 'uicore-elements'),
365 373 'type' => Controls_Manager::SLIDER,
366 374 'range' => [
367 375 'px' => [
368 376 'max' => 3,
@@ -373,9 +381,9 @@
373 381 '{{WRAPPER}} figure img' => 'transition-duration: {{SIZE}}s;',
374 382 ],
375 383 ]
376 384 );
377 - } else if($state == 'active'){
385 + } else if ($state == 'active') {
378 386 $this->add_group_control(
379 387 Group_Control_Css_Filter::get_type(),
380 388 [
381 389 'name' => 'image_css_filters_active',
@@ -385,41 +393,41 @@
385 393 }
386 394 }
387 395
388 396 // Rendering
389 - function render_logo_figure($data, $size)
397 + protected function render_logo_figure($data, $size)
390 398 {
391 399 $image = wp_get_attachment_image_url($data['id'], $size);
392 400 $name = isset($data['name']) ? $data['name'] : '';
393 401 $desc = isset($data['description']) ? $data['description'] : '';
394 402 $alt = $name . ' : ' . $desc;
395 - ?>
396 - <figure class="<?php echo esc_attr($this->get_settings_for_display('logo_hover_animation'));?>">
403 +?>
404 + <figure class="<?php echo esc_attr($this->get_settings_for_display('logo_hover_animation')); ?>">
397 405 <?php
398 - if($image) {
399 - echo wp_get_attachment_image(
400 - $data['id'],
401 - $size,
402 - false,
403 - ['alt' => esc_attr( $alt )]
404 - );
405 - } else {
406 - printf(
407 - '<img src="%s" alt="%s">',
408 - Utils::get_placeholder_image_src(),
409 - esc_attr( $alt )
410 - );
411 - }
412 - ?>
406 + if ($image) {
407 + echo wp_get_attachment_image(
408 + $data['id'],
409 + $size,
410 + false,
411 + ['alt' => esc_attr($alt)]
412 + );
413 + } else {
414 + printf(
415 + '<img src="%s" alt="%s">',
416 + esc_url(Utils::get_placeholder_image_src()),
417 + esc_attr($alt)
418 + );
419 + }
420 + ?>
413 421 </figure>
414 - <?php
422 + <?php
415 423 }
416 - function TRAIT_render_logo_item()
424 + protected function TRAIT_render_logo_item()
417 425 {
418 426 $settings = $this->get_settings_for_display();
419 427
420 428 // Get entrance and item hover animation classes
421 - $entrance = (isset($settings['animate_items']) && $settings['animate_items'] == 'ui-e-grid-animate') ? 'elementor-invisible' : '';
429 + $entrance = $this->is_option('animate_items', 'ui-e-grid-animate') ? 'elementor-invisible' : '';
422 430 $hover = isset($settings['item_hover_animation']) ? $settings['item_hover_animation'] : null;
423 431 $animations = sprintf('%s %s', $entrance, $hover);
424 432
425 433 // Check if any animation that relies on the animation wrapper is set
@@ -424,34 +432,44 @@
424 432
425 433 // Check if any animation that relies on the animation wrapper is set
426 434 $has_animation = !empty($entrance) || !empty($hover) || !empty($settings['item_hover_animation']) || !empty($settings['logo_hover_animation']);
427 435
428 - foreach ( $settings['logo_list'] as $index => $item ) {
436 + // Build wrapper class
437 + $is_carousel = strpos($this->get_name(), 'carousel') !== false;
438 + $this->add_render_attribute([
439 + 'wrapper' => [
440 + 'class' => $is_carousel ? 'ui-e-wrp swiper-slide' : 'ui-e-wrp',
441 + ],
442 + ]);
429 443
430 - // Params
431 - $key = 'logo_'.$index;
432 - $tag = 'div ';
433 - $this->add_render_attribute($key, 'class', 'ui-e-item' );
444 + foreach ($settings['logo_list'] as $index => $item) {
445 + $this->render_logo($index, $item, $settings, $has_animation, $animations);
446 + }
447 + }
434 448
435 - // Build URL
436 - if (!empty($item['link']['url'])) {
437 - $tag = 'a ';
438 - $this->add_link_attributes($key, $item['link'] );
439 - }
440 - ?>
441 - <div class="ui-e-wrp swiper-slide">
442 - <?php if($has_animation) : ?>
443 - <div class='ui-e-animations-wrp <?php echo esc_attr($animations);?>'>
449 + protected function render_logo($index, $item, $settings, $has_animation, $animations)
450 + {
451 + // Params
452 + $key = 'logo_' . $index;
453 + $tag = 'div';
454 + $this->add_render_attribute($key, 'class', 'ui-e-item');
455 +
456 + // Build URL
457 + if (!empty($item['link']['url'])) {
458 + $tag = 'a';
459 + $this->add_link_attributes($key, $item['link']);
460 + }
461 + ?>
462 + <div <?php $this->print_render_attribute_string('wrapper'); ?>>
463 + <?php if ($has_animation) : ?>
464 + <div class='ui-e-animations-wrp <?php echo esc_attr($animations); ?>'>
444 465 <?php endif; ?>
445 - <div class="ui-e-item-wrp">
446 - <<?php echo esc_html($tag);?> <?php $this->print_render_attribute_string($key); ?>>
447 - <?php $this->render_logo_figure($item['image'], $settings['thumbnail_size']); ?>
448 - </<?php echo esc_html($tag);?>>
449 - </div>
450 - <?php if($has_animation) : ?>
451 - </div>
452 - <?php endif; ?>
453 - </div>
454 - <?php
455 - }
466 + <<?php echo Helper::esc_tag($tag); ?> <?php $this->print_render_attribute_string($key); ?>>
467 + <?php $this->render_logo_figure($item['image'], $settings['thumbnail_size']); ?>
468 + </<?php echo Helper::esc_tag($tag); ?>>
469 + <?php if ($has_animation) : ?>
470 + </div>
471 + <?php endif; ?>
472 + </div>
473 +<?php
456 474 }
457 -}
475 +}