PluginProbe ʕ •ᴥ•ʔ
Premium Addons for Elementor – Powerful Elementor Templates & Widgets / 4.1.0
Premium Addons for Elementor – Powerful Elementor Templates & Widgets v4.1.0
4.11.79 4.11.78 4.11.77 4.11.76 4.11.75 3.20.5 4.11.69 3.20.6 4.11.7 3.20.7 4.11.70 3.20.8 4.11.71 3.20.9 4.11.72 3.21.1 4.11.73 3.21.2 4.11.74 3.21.3 4.11.8 3.21.4 4.11.9 3.21.5 4.2.0 3.21.6 4.2.1 3.3.0 4.2.2 3.3.1 4.2.3 3.3.2 4.2.4 3.3.3 4.2.5 3.3.4 4.2.6 3.3.5 4.2.7 3.3.6 4.2.8 3.3.7 4.2.9 3.3.8 4.3.0 3.3.9 4.3.1 3.4.0 4.3.2 3.4.1 4.3.3 3.4.2 4.3.4 3.4.3 4.3.5 3.4.4 4.3.6 3.4.5 4.3.7 3.4.6 4.3.8 3.4.7 4.3.9 3.4.8 4.4.0 3.4.9 4.4.1 3.5.0 4.4.2 3.5.1 4.4.3 3.5.2 4.4.4 3.5.3 4.4.5 3.5.4 4.4.6 3.5.5 4.4.7 3.5.6 4.4.8 3.5.7 4.4.9 3.5.8 4.5.0 3.5.9 4.5.1 3.6.0 4.5.2 3.6.1 4.5.3 3.6.2 4.5.4 3.6.3 4.5.5 3.6.4 4.5.6 3.6.5 4.5.7 3.6.6 4.5.8 3.6.7 4.5.9 3.6.8 4.6.0 3.6.9 4.6.1 3.7.0 4.7.0 3.7.1 4.7.1 3.7.2 4.7.2 3.7.3 4.7.3 3.7.4 4.7.4 3.7.5 4.7.5 3.7.6 4.7.6 3.7.7 4.7.7 3.7.8 4.7.8 3.7.9 4.7.9 3.8.0 4.8.0 3.8.1 4.8.1 3.8.2 4.8.10 3.8.3 4.8.11 3.8.4 4.8.2 3.8.5 4.8.3 3.8.6 4.8.4 3.8.7 4.8.5 3.8.8 4.8.6 3.8.9 4.8.7 3.9.0 4.8.8 3.9.1 4.8.9 3.9.2 4.9.0 3.9.3 4.9.0-beta1 3.9.4 4.9.0-beta2 3.9.5 4.9.1 3.9.6 4.9.10 3.9.7 4.9.11 3.9.8 4.9.12 3.9.9 4.9.13 4.0.1 4.9.14 4.0.3 4.9.15 4.0.4 4.9.16 4.0.5 4.9.17 4.0.6 4.9.18 4.0.7 4.9.19 4.0.8 4.9.2 4.0.9 4.9.20 4.1.0 4.9.21 4.1.1 4.9.22 4.1.2 4.9.23 4.1.3 4.9.24 trunk 4.1.4 4.9.25 1.0 4.1.5 4.9.26 1.01 4.1.6 4.9.27 1.02 4.1.7 4.9.28 1.03 4.1.8 4.9.29 1.04 4.1.9 4.9.3 1.05 4.10.0 4.9.30 1.06 4.10.1 4.9.31 1.07 4.10.10 4.9.32 1.08 4.10.11 4.9.33 1.09 4.10.12 4.9.34 2.0 4.10.13 4.9.35 2.0.1 4.10.14 4.9.36 2.0.2 4.10.15 4.9.37 2.0.3 4.10.16 4.9.38 2.0.4 4.10.17 4.9.39 2.0.5 4.10.18 4.9.4 2.0.6 4.10.19 4.9.40 2.0.7 4.10.2 4.9.41 2.0.8 4.10.20 4.9.42 2.0.9 4.10.21 4.9.43 2.1.0 4.10.22 4.9.45 2.1.1 4.10.23 4.9.46 2.1.2 4.10.24 4.9.47 2.1.3 4.10.25 4.9.48 2.1.4 4.10.26 4.9.49 2.1.5 4.10.27 4.9.5 2.1.5-beta1 4.10.28 4.9.50 2.1.6 4.10.29 4.9.51 2.1.7 4.10.3 4.9.52 2.1.8 4.10.30 4.9.53 2.1.9 4.10.31 4.9.54 2.2.0 4.10.32 4.9.55 2.2.1 4.10.33 4.9.56 2.2.2 4.10.34 4.9.57 2.2.3 4.10.35 4.9.6 2.2.4 4.10.36 4.9.7 2.2.5 4.10.37 4.9.8 2.2.6 4.10.38 4.9.9 2.2.7 4.10.39 2.2.8 4.10.4 2.2.9 4.10.40 2.3.0 4.10.41 2.3.1 4.10.42 2.3.2 4.10.43 2.3.3 4.10.44 2.3.4 4.10.45 2.3.5 4.10.46 2.3.6 4.10.47 2.3.7 4.10.48 2.3.8 4.10.49 2.3.9 4.10.5 2.4.0 4.10.50 2.4.1 4.10.51 2.5.0 4.10.52 2.5.1 4.10.53 2.5.2 4.10.54 2.5.3 4.10.55 2.5.4 4.10.56 2.5.5 4.10.57 2.5.6 4.10.58 2.5.7 4.10.59 2.5.8 4.10.6 2.5.9 4.10.60 2.6.0 4.10.61 2.6.1 4.10.62 2.6.2 4.10.63 2.6.3 4.10.64 2.6.4 4.10.65 2.6.5 4.10.66 2.6.6 4.10.67 2.6.7 4.10.68 2.6.8 4.10.69 2.6.9 4.10.7 2.7.0 4.10.70 2.7.1 4.10.71 2.7.2 4.10.72 2.7.3 4.10.73 2.7.4 4.10.74 2.7.5 4.10.75 2.7.6 4.10.76 2.7.7 4.10.77 2.7.8 4.10.78 2.7.9 4.10.79 2.8.0 4.10.8 2.8.1 4.10.80 2.8.2 4.10.81 2.8.3 4.10.82 2.8.4 4.10.83 2.8.5 4.10.84 2.8.6 4.10.85 2.8.7 4.10.86 2.8.8 4.10.87 2.8.9 4.10.88 2.9.0 4.10.89 2.9.1 4.10.9 2.9.2 4.10.90 2.9.3 4.11.0 2.9.4 4.11.1 2.9.5 4.11.10 2.9.6 4.11.11 2.9.7 4.11.12 2.9.8 4.11.13 2.9.9 4.11.14 3.0.0 4.11.15 3.0.1 4.11.16 3.0.2 4.11.17 3.0.3 4.11.18 3.0.4 4.11.19 3.0.5 4.11.2 3.0.6 4.11.20 3.0.7 4.11.21 3.0.8 4.11.22 3.0.9 4.11.23 3.1.0 4.11.24 3.1.1 4.11.25 3.1.2 4.11.26 3.1.3 4.11.27 3.1.4 4.11.28 3.1.5 4.11.29 3.1.6 4.11.3 3.1.7 4.11.30 3.1.8 4.11.31 3.1.9 4.11.32 3.10.0 4.11.33 3.10.1 4.11.34 3.10.2 4.11.35 3.10.3 4.11.36 3.10.4 4.11.37 3.10.5 4.11.38 3.10.6 4.11.39 3.10.7 4.11.4 3.10.8 4.11.40 3.10.9 4.11.41 3.11.0 4.11.42 3.11.1 4.11.43 3.11.2 4.11.44 3.11.3 4.11.45 3.11.4 4.11.46 3.11.5 4.11.47 3.11.6 4.11.48 3.11.7 4.11.49 3.11.8 4.11.5 3.11.9 4.11.50 3.12.0 4.11.51 3.12.1 4.11.52 3.12.2 4.11.53 3.12.3 4.11.54 3.2.0 4.11.55 3.2.1 4.11.56 3.2.2 4.11.57 3.2.3 4.11.58 3.2.4 4.11.59 3.2.5 4.11.6 3.2.6 4.11.60 3.2.7 4.11.61 3.2.8 4.11.62 3.2.9 4.11.63 3.20.0 4.11.64 3.20.1 4.11.65 3.20.2 4.11.66 3.20.3 4.11.67 3.20.4 4.11.68
premium-addons-for-elementor / widgets / premium-image-separator.php
premium-addons-for-elementor / widgets Last commit date
dep 5 years ago premium-banner.php 5 years ago premium-blog.php 5 years ago premium-button.php 5 years ago premium-carousel.php 5 years ago premium-contactform.php 5 years ago premium-countdown.php 5 years ago premium-counter.php 5 years ago premium-dual-header.php 5 years ago premium-fancytext.php 5 years ago premium-grid.php 5 years ago premium-icon-list.php 5 years ago premium-image-button.php 5 years ago premium-image-scroll.php 5 years ago premium-image-separator.php 5 years ago premium-lottie.php 5 years ago premium-maps.php 5 years ago premium-modalbox.php 5 years ago premium-person.php 5 years ago premium-pricing-table.php 5 years ago premium-progressbar.php 5 years ago premium-testimonials.php 5 years ago premium-title.php 5 years ago premium-videobox.php 5 years ago premium-vscroll.php 5 years ago
premium-image-separator.php
586 lines
1 <?php
2
3 /**
4 * Premium Image Separator.
5 */
6 namespace PremiumAddons\Widgets;
7
8 // Elementor Classes.
9 use Elementor\Modules\DynamicTags\Module as TagsModule;
10 use Elementor\Widget_Base;
11 use Elementor\Utils;
12 use Elementor\Control_Media;
13 use Elementor\Controls_Manager;
14 use Elementor\Scheme_Color;
15 use Elementor\Icons_Manager;
16 use Elementor\Group_Control_Css_Filter;
17 use Elementor\Group_Control_Text_Shadow;
18
19 // PremiumAddons Classes.
20 use PremiumAddons\Includes\Helper_Functions;
21 use PremiumAddons\Includes\Premium_Template_Tags;
22
23 if ( ! defined( 'ABSPATH' ) ) exit; // If this file is called directly, abort.
24
25 /**
26 * Class Premium_Image_Separator
27 */
28 class Premium_Image_Separator extends Widget_Base {
29
30 protected $templateInstance;
31
32 public function getTemplateInstance() {
33 return $this->templateInstance = Premium_Template_Tags::getInstance();
34 }
35
36 public function get_name() {
37 return 'premium-addon-image-separator';
38 }
39
40 public function get_title() {
41 return sprintf( '%1$s %2$s', Helper_Functions::get_prefix(), __('Image Separator', 'premium-addons-for-elementor') );
42 }
43
44 public function get_style_depends() {
45 return [
46 'premium-addons'
47 ];
48 }
49
50 public function get_script_depends() {
51 return [
52 'lottie-js'
53 ];
54 }
55
56 public function get_icon() {
57 return 'pa-image-separator';
58 }
59
60 public function get_categories() {
61 return [ 'premium-elements' ];
62 }
63
64 public function get_keywords() {
65 return [ 'divider', 'section', 'shape' ];
66 }
67
68 public function get_custom_help_url() {
69 return 'https://premiumaddons.com/support/';
70 }
71
72 /**
73 * Register Image Controls controls.
74 *
75 * @since 1.0.0
76 * @access protected
77 */
78 protected function _register_controls() {
79
80 $this->start_controls_section('premium_image_separator_general_settings',
81 [
82 'label' => __('Image Settings', 'premium-addons-for-elementor')
83 ]
84 );
85
86 $this->add_control('separator_type',
87 [
88 'label' => __( 'Separator Type', 'premium-addons-for-elementor' ),
89 'type' => Controls_Manager::SELECT,
90 'options' => [
91 'icon' => __('Icon', 'premium-addons-for-elementor'),
92 'image' => __( 'Image', 'premium-addons-for-elementor'),
93 'animation' => __('Lottie Animation', 'premium-addons-for-elementor'),
94 ],
95 'default' => 'image'
96 ]
97 );
98
99 $this->add_control('separator_icon',
100 [
101 'label' => __( 'Select an Icon', 'premium-addons-for-elementor' ),
102 'type' => Controls_Manager::ICONS,
103 'default' => [
104 'value' => 'fas fa-grip-lines',
105 'library' => 'fa-solid',
106 ],
107 'condition' => [
108 'separator_type' => 'icon'
109 ]
110 ]
111 );
112
113 $this->add_control('premium_image_separator_image',
114 [
115 'label' => __('Image', 'premium-addons-for-elementor'),
116 'description' => __('Choose the separator image', 'premium-addons-for-elementor' ),
117 'type' => Controls_Manager::MEDIA,
118 'dynamic' => [ 'active' => true ],
119 'default' => [
120 'url' => Utils::get_placeholder_image_src(),
121 ],
122 'label_block' => true,
123 'condition' => [
124 'separator_type' => 'image'
125 ]
126 ]
127 );
128
129 $this->add_control('lottie_url',
130 [
131 'label' => __( 'Animation JSON URL', 'premium-addons-for-elementor' ),
132 'type' => Controls_Manager::TEXT,
133 'dynamic' => [ 'active' => true ],
134 'description' => 'Get JSON code URL from <a href="https://lottiefiles.com/" target="_blank">here</a>',
135 'label_block' => true,
136 'condition' => [
137 'separator_type' => 'animation'
138 ],
139 ]
140 );
141
142 $this->add_control('lottie_loop',
143 [
144 'label' => __('Loop','premium-addons-for-elementor'),
145 'type' => Controls_Manager::SWITCHER,
146 'return_value' => 'true',
147 'default' => 'true',
148 'condition' => [
149 'separator_type' => 'animation'
150 ],
151 ]
152 );
153
154 $this->add_control('lottie_reverse',
155 [
156 'label' => __('Reverse','premium-addons-for-elementor'),
157 'type' => Controls_Manager::SWITCHER,
158 'return_value' => 'true',
159 'condition' => [
160 'separator_type' => 'animation'
161 ],
162 ]
163 );
164
165 $this->add_control('lottie_hover',
166 [
167 'label' => __('Only Play on Hover','premium-addons-for-elementor'),
168 'type' => Controls_Manager::SWITCHER,
169 'return_value' => 'true',
170 'condition' => [
171 'separator_type' => 'animation'
172 ],
173 ]
174 );
175
176 $this->add_responsive_control('premium_image_separator_image_size',
177 [
178 'label' => __('Size', 'premium-addons-for-elementor'),
179 'type' => Controls_Manager::SLIDER,
180 'size_units' => ['px', 'em', '%'],
181 'default' => [
182 'unit' => 'px',
183 'size' => 200,
184 ],
185 'range' => [
186 'px' => [
187 'min' => 1,
188 'max' => 800,
189 ],
190 'em' => [
191 'min' => 1,
192 'max' => 30,
193 ],
194 ],
195 'selectors' => [
196 '{{WRAPPER}} .premium-image-separator-container img' => 'width: {{SIZE}}{{UNIT}}',
197 '{{WRAPPER}} .premium-image-separator-container i' => 'font-size: {{SIZE}}{{UNIT}}',
198 '{{WRAPPER}} .premium-image-separator-container svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}'
199 ]
200 ]
201 );
202
203 $this->add_responsive_control('premium_image_separator_image_gutter',
204 [
205 'label' => __('Gutter (%)', 'premium-addons-for-elementor'),
206 'type' => Controls_Manager::NUMBER,
207 'default' => -50,
208 'description' => __('-50% is default. Increase to push the image outside or decrease to pull the image inside.','premium-addons-for-elementor'),
209 'selectors' => [
210 '{{WRAPPER}} .premium-image-separator-container' => 'transform: translateY( {{VALUE}}% );'
211 ]
212 ]
213 );
214
215 $this->add_control('premium_image_separator_image_align',
216 [
217 'label' => __('Alignment', 'premium-addons-for-elementor'),
218 'type' => Controls_Manager::CHOOSE,
219 'options' => [
220 'left' => [
221 'title' => __('Left', 'premium-addons-for-elementor'),
222 'icon' => 'fa fa-align-left'
223 ],
224 'center' => [
225 'title' => __('Center', 'premium-addons-for-elementor'),
226 'icon' => 'fa fa-align-center'
227 ],
228 'right' => [
229 'title' => __('Right', 'premium-addons-for-elementor'),
230 'icon' => 'fa fa-align-right'
231 ],
232 ],
233 'default' => 'center',
234 'selectors' => [
235 '{{WRAPPER}} .premium-image-separator-container' => 'text-align: {{VALUE}};',
236 ]
237 ]
238 );
239
240 $this->add_control('premium_image_separator_link_switcher',
241 [
242 'label' => __('Link', 'premium-addons-for-elementor'),
243 'type' => Controls_Manager::SWITCHER,
244 'description' => __('Add a custom link or select an existing page link','premium-addons-for-elementor'),
245 ]
246 );
247
248 $this->add_control('premium_image_separator_link_type',
249 [
250 'label' => __('Link/URL', 'premium-addons-for-elementor'),
251 'type' => Controls_Manager::SELECT,
252 'options' => [
253 'url' => __('URL', 'premium-addons-for-elementor'),
254 'link' => __('Existing Page', 'premium-addons-for-elementor'),
255 ],
256 'default' => 'url',
257 'label_block' => true,
258 'condition' => [
259 'premium_image_separator_link_switcher' => 'yes',
260 ],
261 ]
262 );
263
264 $this->add_control('premium_image_separator_existing_page',
265 [
266 'label' => __('Existing Page', 'premium-addons-for-elementor'),
267 'type' => Controls_Manager::SELECT2,
268 'options' => $this->getTemplateInstance()->get_all_posts(),
269 'multiple' => false,
270 'label_block' => true,
271 'condition' => [
272 'premium_image_separator_link_switcher' => 'yes',
273 'premium_image_separator_link_type' => 'link',
274 ],
275 ]
276 );
277
278 $this->add_control('premium_image_separator_image_link',
279 [
280 'label' => __('URL', 'premium-addons-for-elementor'),
281 'type' => Controls_Manager::TEXT,
282 'dynamic' => [
283 'active' => true,
284 'categories' => [
285 TagsModule::POST_META_CATEGORY,
286 TagsModule::URL_CATEGORY
287 ]
288 ],
289 'label_block' => true,
290 'condition' => [
291 'premium_image_separator_link_switcher' => 'yes',
292 'premium_image_separator_link_type' => 'url',
293 ],
294 ]
295 );
296
297 $this->add_control('premium_image_separator_image_link_text',
298 [
299 'label' => __('Image Title', 'premium-addons-for-elementor'),
300 'type' => Controls_Manager::TEXT,
301 'label_block' => true,
302 'condition' => [
303 'premium_image_separator_link_switcher' => 'yes',
304 ],
305 ]
306 );
307
308 $this->add_control('link_new_tab',
309 [
310 'label' => __('Open Link in New Tab', 'premium-addons-for-elementor'),
311 'type' => Controls_Manager::SWITCHER,
312 'default' => 'yes',
313 'condition' => [
314 'premium_image_separator_link_switcher' => 'yes',
315 ],
316 ]
317 );
318
319 $this->end_controls_section();
320
321 $this->start_controls_section('premium_image_separator_style',
322 [
323 'label' => __('Separator', 'premium-addons-for-elementor'),
324 'tab' => Controls_Manager::TAB_STYLE,
325 ]
326 );
327
328 $this->add_group_control(
329 Group_Control_Css_Filter::get_type(),
330 [
331 'name' => 'css_filters',
332 'selector' => '{{WRAPPER}} .premium-image-separator-container',
333 'condition' => [
334 'separator_type!' => 'icon'
335 ]
336 ]
337 );
338
339 $this->add_group_control(
340 Group_Control_Css_Filter::get_type(),
341 [
342 'name' => 'hover_css_filters',
343 'label' => __('Hover CSS Filters', 'premium-addons-for-elementor'),
344 'selector' => '{{WRAPPER}} .premium-image-separator-container:hover',
345 'condition' => [
346 'separator_type!' => 'icon'
347 ]
348 ]
349 );
350
351 $this->add_control('icon_color',
352 [
353 'label' => __( 'Color', 'premium-addons-for-elementor' ),
354 'type' => Controls_Manager::COLOR,
355 'scheme' => [
356 'type' => Scheme_Color::get_type(),
357 'value' => Scheme_Color::COLOR_1,
358 ],
359 'selectors' => [
360 '{{WRAPPER}} .premium-image-separator-container i' => 'color: {{VALUE}}'
361 ],
362 'condition' => [
363 'separator_type' => 'icon'
364 ]
365 ]
366 );
367
368 $this->add_control('icon_hover_color',
369 [
370 'label' => __( 'Hover Color', 'premium-addons-for-elementor' ),
371 'type' => Controls_Manager::COLOR,
372 'scheme' => [
373 'type' => Scheme_Color::get_type(),
374 'value' => Scheme_Color::COLOR_1,
375 ],
376 'selectors' => [
377 '{{WRAPPER}} .premium-image-separator-container i:hover' => 'color: {{VALUE}}'
378 ],
379 'condition' => [
380 'separator_type' => 'icon'
381 ]
382 ]
383 );
384
385 $this->add_control('icon_background_color',
386 [
387 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
388 'type' => Controls_Manager::COLOR,
389 'scheme' => [
390 'type' => Scheme_Color::get_type(),
391 'value' => Scheme_Color::COLOR_2,
392 ],
393 'selectors' => [
394 '{{WRAPPER}} .premium-image-separator-container i' => 'background-color: {{VALUE}}'
395 ],
396 'condition' => [
397 'separator_type' => 'icon'
398 ]
399 ]
400 );
401
402 $this->add_control('icon_hover_background_color',
403 [
404 'label' => __( 'Hover Background Color', 'premium-addons-for-elementor' ),
405 'type' => Controls_Manager::COLOR,
406 'scheme' => [
407 'type' => Scheme_Color::get_type(),
408 'value' => Scheme_Color::COLOR_2,
409 ],
410 'selectors' => [
411 '{{WRAPPER}} .premium-image-separator-container i:hover' => 'background-color: {{VALUE}}'
412 ],
413 'condition' => [
414 'separator_type' => 'icon'
415 ]
416 ]
417 );
418
419 $this->add_responsive_control('separator_border_radius',
420 [
421 'label' => __('Border Radius', 'premium-addons-for-elementor'),
422 'type' => Controls_Manager::DIMENSIONS,
423 'size_units' => ['px', 'em', '%'],
424 'selectors' => [
425 '{{WRAPPER}} .premium-image-separator-container i, {{WRAPPER}} .premium-image-separator-container img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}'
426 ],
427 ]
428 );
429
430 $this->add_group_control(
431 Group_Control_Text_Shadow::get_type(),
432 [
433 'name' => 'separator_shadow',
434 'selector' => '{{WRAPPER}} .premium-image-separator-container i',
435 'condition' => [
436 'separator_type' => 'icon'
437 ]
438 ]
439 );
440
441 $this->add_responsive_control('icon_padding',
442 [
443 'label' => __('Padding', 'premium-addons-for-elementor'),
444 'type' => Controls_Manager::DIMENSIONS,
445 'size_units' => ['px', 'em', '%'],
446 'selectors' => [
447 '{{WRAPPER}} .premium-image-separator-container i' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}'
448 ],
449 'condition' => [
450 'separator_type' => 'icon'
451 ]
452 ]
453 );
454
455 $this->end_controls_section();
456
457 }
458
459 /**
460 * Render Image Separator widget output on the frontend.
461 *
462 * Written in PHP and used to generate the final HTML.
463 *
464 * @since 1.0.0
465 * @access protected
466 */
467 protected function render() {
468
469 $settings = $this->get_settings_for_display();
470
471 $type = $settings['separator_type'];
472
473 if( 'yes' === $settings['premium_image_separator_link_switcher'] ) {
474 $link_type = $settings['premium_image_separator_link_type'];
475
476 if( 'url' === $link_type ) {
477 $url = $settings['premium_image_separator_image_link'];
478 } else {
479 $url = get_permalink( $settings['premium_image_separator_existing_page'] );
480 }
481
482 $this->add_render_attribute( 'link', [
483 'class' => 'premium-image-separator-link',
484 'href' => $url
485 ]);
486
487 if( 'yes' === $settings['link_new_tab'] ) {
488 $this->add_render_attribute( 'link', 'target', '_blank');
489 }
490
491 if( ! empty ( $settings['premium_image_separator_image_link_text']) ) {
492 $this->add_render_attribute( 'link', 'title', $settings['premium_image_separator_image_link_text'] );
493 }
494
495 }
496
497 if( 'image' === $type ) {
498 $alt = esc_attr( Control_Media::get_image_alt( $settings['premium_image_separator_image'] ) );
499 } elseif ( 'animation' === $type ) {
500 $this->add_render_attribute( 'separator_lottie', [
501 'class' => 'premium-lottie-animation',
502 'data-lottie-url' => $settings['lottie_url'],
503 'data-lottie-loop' => $settings['lottie_loop'],
504 'data-lottie-reverse' => $settings['lottie_reverse'],
505 'data-lottie-hover' => $settings['lottie_hover']
506 ]);
507 }
508 ?>
509
510 <div class="premium-image-separator-container">
511 <?php if( 'image' === $type ) : ?>
512 <img src="<?php echo $settings['premium_image_separator_image']['url']; ?>" alt="<?php echo $alt; ?>">
513 <?php elseif( 'icon' === $type ) :
514 Icons_Manager::render_icon( $settings['separator_icon'], [ 'aria-hidden' => 'true' ] );
515 else: ?>
516 <div <?php echo $this->get_render_attribute_string( 'separator_lottie' ); ?>></div>
517 <?php endif; ?>
518 <?php if ( $settings['premium_image_separator_link_switcher'] === 'yes' && ! empty( $url ) ) : ?>
519 <a <?php echo $this->get_render_attribute_string( 'link' ); ?>></a>
520 <?php endif; ?>
521 </div>
522 <?php
523 }
524
525 /**
526 * Render Image Separtor widget output in the editor.
527 *
528 * Written as a Backbone JavaScript template and used to generate the live preview.
529 *
530 * @since 1.0.0
531 * @access protected
532 */
533 protected function content_template() {
534 ?>
535 <#
536 var type = settings.separator_type,
537 linkSwitch = settings.premium_image_separator_link_switcher;
538
539 if( 'image' === type ) {
540 var imgUrl = settings.premium_image_separator_image.url;
541 } else if ( 'icon' === type ) {
542 var iconHTML = elementor.helpers.renderIcon( view, settings.separator_icon, { 'aria-hidden': true }, 'i' , 'object' );
543 } else {
544
545 view.addRenderAttribute( 'separator_lottie', {
546 'class': 'premium-lottie-animation',
547 'data-lottie-url': settings.lottie_url,
548 'data-lottie-loop': settings.lottie_loop,
549 'data-lottie-reverse': settings.lottie_reverse,
550 'data-lottie-hover': settings.lottie_hover
551 });
552
553 }
554
555 if( 'yes' === linkSwitch ) {
556 var linkType = settings.premium_image_separator_link_type,
557 linkTitle = settings.premium_image_separator_image_link_text,
558 linkUrl = ( 'url' == linkType ) ? settings.premium_image_separator_image_link : settings.premium_image_separator_existing_page;
559
560 view.addRenderAttribute( 'link', 'class', 'premium-image-separator-link' );
561 view.addRenderAttribute( 'link', 'href', linkUrl );
562
563 if( '' !== linkTitle ) {
564 view.addRenderAttribute( 'link', 'title', linkTitle );
565 }
566
567 }
568
569 #>
570
571 <div class="premium-image-separator-container">
572 <# if( 'image' === type ) { #>
573 <img alt="image separator" src="{{ imgUrl }}">
574 <# } else if( 'icon' === type ) { #>
575 {{{ iconHTML.value }}}
576 <# } else { #>
577 <div {{{ view.getRenderAttributeString('separator_lottie') }}}></div>
578 <# } #>
579 <# if( 'yes' === linkSwitch ) { #>
580 <a {{{ view.getRenderAttributeString( 'link' ) }}}></a>
581 <# } #>
582 </div>
583
584 <?php
585 }
586 }