PluginProbe ʕ •ᴥ•ʔ
Premium Addons for Elementor – Powerful Elementor Templates & Widgets / 4.11.84
Premium Addons for Elementor – Powerful Elementor Templates & Widgets v4.11.84
4.11.84 4.11.83 4.11.82 4.11.80 4.11.81 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-svg-drawer.php
premium-addons-for-elementor / widgets Last commit date
dep 3 weeks ago premium-banner.php 1 day ago premium-blog.php 2 weeks ago premium-button.php 2 weeks ago premium-carousel.php 2 weeks ago premium-contactform.php 2 weeks ago premium-countdown.php 2 weeks ago premium-counter.php 2 weeks ago premium-dual-header.php 2 weeks ago premium-fancytext.php 2 weeks ago premium-grid.php 2 weeks ago premium-icon-list.php 2 weeks ago premium-image-button.php 2 weeks ago premium-image-scroll.php 2 weeks ago premium-image-separator.php 2 weeks ago premium-lottie.php 2 weeks ago premium-maps.php 2 days ago premium-media-wheel.php 2 weeks ago premium-mobile-menu.php 2 weeks ago premium-modalbox.php 2 days ago premium-nav-menu.php 2 weeks ago premium-notifications.php 2 weeks ago premium-person.php 2 weeks ago premium-pinterest-feed.php 2 weeks ago premium-post-ticker.php 2 weeks ago premium-pricing-table.php 2 days ago premium-progressbar.php 2 weeks ago premium-search-form.php 2 days ago premium-svg-drawer.php 2 weeks ago premium-tcloud.php 2 weeks ago premium-testimonials.php 2 weeks ago premium-textual-showcase.php 2 weeks ago premium-tiktok-feed.php 2 weeks ago premium-title.php 2 days ago premium-videobox.php 2 weeks ago premium-vscroll.php 2 weeks ago premium-weather.php 2 weeks ago premium-world-clock.php 2 weeks ago
premium-svg-drawer.php
970 lines
1 <?php
2 /**
3 * Class: Premium_SVG_Drawer
4 * Name: SVG Draw
5 * Slug: premium-svg-drawer
6 */
7
8 namespace PremiumAddons\Widgets;
9
10 // Elementor Classes.
11 use Elementor\Plugin;
12 use Elementor\Widget_Base;
13 use Elementor\Icons_Manager;
14 use Elementor\Controls_Manager;
15 use Elementor\Group_Control_Border;
16 use PremiumAddons\Includes\Controls\Premium_Background;
17 use Elementor\Group_Control_Typography;
18 use Elementor\Group_Control_Text_Shadow;
19
20 // PremiumAddons Classes.
21 use PremiumAddons\Includes\Helper_Functions;
22
23 if ( ! defined( 'ABSPATH' ) ) {
24 exit;
25 }
26
27 /**
28 * Class Premium_SVG_Drawer
29 */
30 class Premium_SVG_Drawer extends Widget_Base {
31
32 /**
33 * Retrieve Widget Name.
34 *
35 * @since 1.0.0
36 * @access public
37 */
38 public function get_name() {
39 return 'premium-svg-drawer';
40 }
41
42 /**
43 * Retrieve Widget Title.
44 *
45 * @since 1.0.0
46 * @access public
47 */
48 public function get_title() {
49 return __( 'SVG Draw', 'premium-addons-for-elementor' );
50 }
51
52 /**
53 * Retrieve Widget Icon.
54 *
55 * @since 1.0.0
56 * @access public
57 *
58 * @return string widget icon.
59 */
60 public function get_icon() {
61 return 'pa-pro-svg-drawer';
62 }
63
64 /**
65 * Retrieve Widget Categories.
66 *
67 * @since 1.5.1
68 * @access public
69 *
70 * @return array Widget categories.
71 */
72 public function get_categories() {
73 return array( 'premium-elements' );
74 }
75
76 /**
77 * Retrieve Widget Keywords.
78 *
79 * @since 1.0.0
80 * @access public
81 *
82 * @return array Widget keywords.
83 */
84 public function get_keywords() {
85 return array( 'pa', 'premium', 'premium svg draw', 'icon', 'animate', 'custom', 'library', 'animation' );
86 }
87
88 protected function is_dynamic_content(): bool {
89 return false;
90 }
91
92 /**
93 * Retrieve Widget Dependent CSS.
94 *
95 * @since 1.0.0
96 * @access public
97 *
98 * @return array CSS script handles.
99 */
100 public function get_style_depends() {
101 return array(
102 'premium-pro',
103 );
104 }
105
106 /**
107 * Retrieve Widget Dependent JS.
108 *
109 * @since 1.0.0
110 * @access public
111 *
112 * @return array JS script handles.
113 */
114 public function get_script_depends() {
115
116 $is_edit = Helper_Functions::is_edit_mode();
117
118 $scripts = array();
119
120 if ( $is_edit ) {
121 $scripts = array( 'pa-tweenmax', 'pa-scrolltrigger', 'pa-gsap', 'premium-addons', 'pa-motionpath' );
122 } else {
123
124 $settings = $this->get_settings();
125
126 if ( 'yes' === $settings['animate_icon'] ) {
127 $scripts[] = 'pa-tweenmax';
128 $scripts[] = 'pa-scrolltrigger';
129 $scripts[] = 'pa-gsap';
130 $scripts[] = 'pa-motionpath';
131 }
132 }
133
134 $scripts[] = 'premium-addons';
135
136 return $scripts;
137 }
138
139 /**
140 * Retrieve Widget Support URL.
141 *
142 * @access public
143 *
144 * @return string support URL.
145 */
146 public function get_custom_help_url() {
147 return 'https://premiumaddons.com/support/';
148 }
149
150 public function has_widget_inner_wrapper(): bool {
151 return ! Helper_Functions::check_elementor_experiment( 'e_optimized_markup' );
152 }
153
154 /**
155 * Register SVG Draw controls.
156 *
157 * @since 1.0.0
158 * @access protected
159 */
160 protected function register_controls() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
161
162 $this->start_controls_section(
163 'general_section',
164 array(
165 'label' => __( 'General', 'premium-addons-for-elementor' ),
166 )
167 );
168
169 $this->add_control(
170 'icon_type',
171 array(
172 'label' => __( 'SVG Type', 'premium-addons-for-elementor' ),
173 'type' => Controls_Manager::SELECT,
174 'options' => array(
175 'icon' => __( 'Font Awesome Icon', 'premium-addons-for-elementor' ),
176 'custom' => __( 'Custom SVG', 'premium-addons-for-elementor' ),
177 ),
178 'default' => 'icon',
179 'label_block' => true,
180 )
181 );
182
183 $this->add_control(
184 'font_icon',
185 array(
186 'label' => __( 'Select Icon', 'premium-addons-for-elementor' ),
187 'type' => Controls_Manager::ICONS,
188 'skin' => 'inline',
189 'classes' => 'editor-pa-icon-control',
190 'exclude_inline_options' => array( 'svg' ),
191 'default' => array(
192 'value' => 'fas fa-star',
193 'library' => 'fa-solid',
194 ),
195 'label_block' => false,
196 'condition' => array(
197 'icon_type' => 'icon',
198 ),
199 )
200 );
201
202 $this->add_control(
203 'custom_svg',
204 array(
205 'label' => __( 'SVG Code', 'premium-addons-for-elementor' ),
206 'type' => Controls_Manager::TEXTAREA,
207 'description' => 'You can use these sites to create SVGs: <a href="https://danmarshall.github.io/google-font-to-svg-path/" target="_blank">Google Fonts</a> and <a href="https://boxy-svg.com/" target="_blank">Boxy SVG</a>',
208 'condition' => array(
209 'icon_type' => 'custom',
210 ),
211 'ai' => array(
212 'active' => false,
213 ),
214 )
215 );
216
217 $this->add_control(
218 'custom_svg_note',
219 array(
220 'raw' => __( 'Please note that your SVG code must contain a path element so it can be animated. For example, path, circle, square, etc.', 'premium-addons-for-elementor' ),
221 'type' => Controls_Manager::RAW_HTML,
222 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning',
223 'condition' => array(
224 'icon_type' => 'custom',
225 ),
226 )
227 );
228
229 $this->add_responsive_control(
230 'icon_width',
231 array(
232 'label' => __( 'Width', 'premium-addons-for-elementor' ),
233 'type' => Controls_Manager::SLIDER,
234 'size_units' => array( 'px', 'em', '%', 'custom' ),
235 'range' => array(
236 'px' => array(
237 'min' => 1,
238 'max' => 600,
239 ),
240 'em' => array(
241 'min' => 1,
242 'max' => 30,
243 ),
244 ),
245 'default' => array(
246 'size' => 100,
247 'unit' => 'px',
248 ),
249 'condition' => array(
250 'icon_type' => 'custom',
251 ),
252 'selectors' => array(
253 '{{WRAPPER}} .premium-svg-draw svg' => 'width: {{SIZE}}{{UNIT}};',
254 ),
255 )
256 );
257
258 $this->add_responsive_control(
259 'icon_height',
260 array(
261 'label' => __( 'Height', 'premium-addons-for-elementor' ),
262 'type' => Controls_Manager::SLIDER,
263 'size_units' => array( 'px', 'em', 'custom' ),
264 'range' => array(
265 'px' => array(
266 'min' => 1,
267 'max' => 600,
268 ),
269 'em' => array(
270 'min' => 1,
271 'max' => 30,
272 ),
273 ),
274 'default' => array(
275 'size' => 100,
276 'unit' => 'px',
277 ),
278 'condition' => array(
279 'icon_type' => 'custom',
280 ),
281 'selectors' => array(
282 '{{WRAPPER}} .premium-svg-draw svg' => 'height: {{SIZE}}{{UNIT}}',
283 ),
284 )
285 );
286
287 $this->add_responsive_control(
288 'icon_size',
289 array(
290 'label' => __( 'Size', 'premium-addons-for-elementor' ),
291 'type' => Controls_Manager::SLIDER,
292 'size_units' => array( 'px', 'em' ),
293 'range' => array(
294 'px' => array(
295 'min' => 1,
296 'max' => 500,
297 ),
298 'em' => array(
299 'min' => 1,
300 'max' => 30,
301 ),
302 ),
303 'default' => array(
304 'size' => 250,
305 'unit' => 'px',
306 ),
307 'condition' => array(
308 'icon_type' => 'icon',
309 ),
310 'selectors' => array(
311 '{{WRAPPER}} .premium-svg-draw svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}',
312 ),
313 )
314 );
315
316 $this->add_responsive_control(
317 'icon_align',
318 array(
319 'label' => __( 'Alignment', 'premium-addons-for-elementor' ),
320 'type' => Controls_Manager::CHOOSE,
321 'options' => array(
322 'left' => array(
323 'title' => __( 'Left', 'premium-addons-for-elementor' ),
324 'icon' => 'eicon-text-align-left',
325 ),
326 'center' => array(
327 'title' => __( 'Center', 'premium-addons-for-elementor' ),
328 'icon' => 'eicon-text-align-center',
329 ),
330 'right' => array(
331 'title' => __( 'Right', 'premium-addons-for-elementor' ),
332 'icon' => 'eicon-text-align-right',
333 ),
334 ),
335 'default' => 'center',
336 'selectors' => array(
337 '{{WRAPPER}} .premium-svg-draw' => 'text-align: {{VALUE}};',
338 ),
339 'toggle' => false,
340 )
341 );
342
343 $this->add_control(
344 'animate_icon',
345 array(
346 'label' => __( 'Draw SVG', 'premium-addons-for-elementor' ),
347 'type' => Controls_Manager::SWITCHER,
348 'prefix_class' => 'premium-svg-animated-',
349 'render_type' => 'template',
350 'separator' => 'before',
351 'default' => 'yes',
352 'condition' => array(
353 'magic_scroll!' => 'yes',
354 ),
355 )
356 );
357
358 $this->add_control(
359 'animation_reverse',
360 array(
361 'label' => __( 'Reverse Animation', 'premium-addons-for-elementor' ),
362 'type' => Controls_Manager::SWITCHER,
363 'prefix_class' => 'premium-svg-anim-rev-',
364 'render_type' => 'template',
365 'separator' => 'before',
366 'condition' => array(
367 'animate_icon' => 'yes',
368 'magic_scroll!' => 'yes',
369 ),
370 )
371 );
372
373 $this->add_control(
374 'animate_start_point',
375 array(
376 'label' => __( 'Start Point (%)', 'premium-addons-for-elementor' ),
377 'type' => Controls_Manager::SLIDER,
378 'description' => __( 'Set the point that the SVG should start from.', 'premium-addons-for-elementor' ),
379 'default' => array(
380 'unit' => '%',
381 'size' => 0,
382 ),
383 'condition' => array(
384 'animate_icon' => 'yes',
385 'magic_scroll!' => 'yes',
386 'animation_reverse!' => 'yes',
387 ),
388 'frontend_available' => true,
389 )
390 );
391
392 $this->add_control(
393 'animate_end_point',
394 array(
395 'label' => __( 'End Point (%)', 'premium-addons-for-elementor' ),
396 'type' => Controls_Manager::SLIDER,
397 'description' => __( 'Set the point that the SVG should end at.', 'premium-addons-for-elementor' ),
398 'default' => array(
399 'unit' => '%',
400 'size' => 0,
401 ),
402 'condition' => array(
403 'animate_icon' => 'yes',
404 'magic_scroll!' => 'yes',
405 'animation_reverse' => 'yes',
406 ),
407 'frontend_available' => true,
408 )
409 );
410
411 $this->add_control(
412 'scroll_action',
413 array(
414 'label' => __( 'How this animation should work?', 'premium-addons-for-elementor' ),
415 'type' => Controls_Manager::SELECT,
416 'options' => array(
417 'automatic' => __( 'Complete Draw When Visible On Viewport', 'premium-addons-for-elementor' ),
418 'viewport' => __( 'Draw On Scroll', 'premium-addons-for-elementor' ),
419 'hover' => __( 'Draw On Hover', 'premium-addons-for-elementor' ),
420 ),
421 'default' => 'viewport',
422 'label_block' => true,
423 'condition' => array(
424 'animate_icon' => 'yes',
425 'magic_scroll!' => 'yes',
426 ),
427 'frontend_available' => true,
428 )
429 );
430
431 $this->add_control(
432 'frames',
433 array(
434 'label' => __( 'Speed', 'premium-addons-for-elementor' ),
435 'type' => Controls_Manager::NUMBER,
436 'description' => __( 'Larger value means longer drawing duration', 'premium-addons-for-elementor' ),
437 'default' => 5,
438 'min' => 1,
439 'max' => 100,
440 'condition' => array(
441 'animate_icon' => 'yes',
442 'scroll_action!' => 'viewport',
443 'magic_scroll!' => 'yes',
444 ),
445 'frontend_available' => true,
446 )
447 );
448
449 $this->add_control(
450 'loop',
451 array(
452 'label' => __( 'Loop', 'premium-addons-for-elementor' ),
453 'type' => Controls_Manager::SWITCHER,
454 'condition' => array(
455 'animate_icon' => 'yes',
456 'scroll_action!' => 'viewport',
457 'magic_scroll!' => 'yes',
458 ),
459 'return_value' => 'true',
460 'frontend_available' => true,
461 )
462 );
463
464 $this->add_control(
465 'yoyo',
466 array(
467 'label' => __( 'Yoyo Effect', 'premium-addons-for-elementor' ),
468 'type' => Controls_Manager::SWITCHER,
469 'condition' => array(
470 'animate_icon' => 'yes',
471 'scroll_action!' => 'viewport',
472 'magic_scroll!' => 'yes',
473 'loop' => 'true',
474 ),
475 'frontend_available' => true,
476 )
477 );
478
479 $this->add_control(
480 'animate_trigger',
481 array(
482 'label' => __( 'When the draw should start?', 'premium-addons-for-elementor' ),
483 'type' => Controls_Manager::SELECT,
484 'options' => array(
485 'top' => __( 'Top of Viewport Hits The Widget', 'premium-addons-for-elementor' ),
486 'center' => __( 'Center of Viewport Hits The Widget', 'premium-addons-for-elementor' ),
487 'custom' => __( 'Custom Offset', 'premium-addons-for-elementor' ),
488 ),
489 'default' => 'center',
490 'label_block' => true,
491 'condition' => array(
492 'animate_icon' => 'yes',
493 'scroll_action' => 'automatic',
494 'magic_scroll!' => 'yes',
495 ),
496 'frontend_available' => true,
497 )
498 );
499
500 $this->add_control(
501 'animate_offset',
502 array(
503 'label' => __( 'Offset (%)', 'premium-addons-for-elementor' ),
504 'type' => Controls_Manager::SLIDER,
505 'default' => array(
506 'size' => 50,
507 'unit' => '%',
508 ),
509 'frontend_available' => true,
510 'conditions' => array(
511 'terms' => array(
512 array(
513 'name' => 'animate_icon',
514 'value' => 'yes',
515 ),
516 array(
517 'name' => 'magic_scroll',
518 'operator' => '!=',
519 'value' => 'yes',
520 ),
521 array(
522 'name' => 'scroll_action',
523 'operator' => '!=',
524 'value' => 'hover',
525 ),
526 array(
527 'relation' => 'or',
528 'terms' => array(
529 array(
530 'name' => 'scroll_action',
531 'value' => 'viewport',
532 ),
533 array(
534 'name' => 'animate_trigger',
535 'value' => 'custom',
536 ),
537 ),
538 ),
539 ),
540 ),
541 )
542 );
543
544 $this->add_control(
545 'draw_speed',
546 array(
547 'label' => __( 'Decrease Draw Speed By', 'premium-addons-for-elementor' ),
548 'type' => Controls_Manager::SLIDER,
549 'description' => __( 'The larger the value you set the slower the SVG is drawn.', 'premium-addons-for-elementor' ),
550 'range' => array(
551 'px' => array(
552 'min' => 0,
553 'max' => 1,
554 'step' => 0.1,
555 ),
556 ),
557 'default' => array(
558 'size' => 0.3,
559 'unit' => 'px',
560 ),
561 'condition' => array(
562 'animate_icon' => 'yes',
563 'scroll_action' => 'viewport',
564 'magic_scroll!' => 'yes',
565 ),
566 'frontend_available' => true,
567 )
568 );
569
570 $this->add_control(
571 'animation_sync',
572 array(
573 'label' => __( 'Draw All Paths Together', 'premium-addons-for-elementor' ),
574 'type' => Controls_Manager::SWITCHER,
575 'prefix_class' => 'premium-svg-sync-',
576 'separator' => 'before',
577 'render_type' => 'template',
578 'condition' => array(
579 'animate_icon' => 'yes',
580 'icon_type!' => 'icon',
581 'magic_scroll!' => 'yes',
582 ),
583 )
584 );
585
586 $this->add_control(
587 'anim_rev',
588 array(
589 'label' => __( 'Restart Animation on Scroll Up', 'premium-addons-for-elementor' ),
590 'type' => Controls_Manager::SWITCHER,
591 'render_type' => 'template',
592 'default' => 'yes',
593 'condition' => array(
594 'animate_icon' => 'yes',
595 'scroll_action' => 'automatic',
596 'magic_scroll!' => 'yes',
597 ),
598 'frontend_available' => true,
599 )
600 );
601
602 $this->add_control(
603 'svg_fill',
604 array(
605 'label' => __( 'Fill Color After Draw', 'premium-addons-for-elementor' ),
606 'type' => Controls_Manager::SWITCHER,
607 'condition' => array(
608 'animate_icon' => 'yes',
609 'magic_scroll!' => 'yes',
610 ),
611 'frontend_available' => true,
612 )
613 );
614
615 $this->add_control(
616 'svg_fill_speed',
617 array(
618 'label' => __( 'Fill Color Speed', 'premium-addons-for-elementor' ),
619 'type' => Controls_Manager::SLIDER,
620 'range' => array(
621 'px' => array(
622 'min' => 0,
623 'max' => 5,
624 'step' => 0.1,
625 ),
626 ),
627 'condition' => array(
628 'animate_icon' => 'yes',
629 'scroll_action!' => 'viewport',
630 'magic_scroll!' => 'yes',
631 ),
632 'frontend_available' => true,
633 )
634 );
635
636 $this->add_control(
637 'link',
638 array(
639 'label' => __( 'Link', 'premium-addons-for-elementor' ),
640 'type' => Controls_Manager::URL,
641 'dynamic' => array( 'active' => true ),
642 'placeholder' => 'https://premiumaddons.com/',
643 'label_block' => true,
644 'separator' => 'before',
645 )
646 );
647
648 $this->add_control(
649 'magic_scroll',
650 array(
651 'label' => __( 'Use With Magic Scroll', 'premium-addons-for-elementor' ),
652 'type' => Controls_Manager::SWITCHER,
653 'description' => __( 'Enable this option if you want to draw the SVG using ', 'premium-addons-for-elementor' ) . '<a href="https://premiumaddons.com/elementor-magic-scroll-global-addon/" target="_blank">Magic Scroll addon.</a>',
654 'render_type' => 'template',
655 'separator' => 'before',
656 )
657 );
658
659 $this->end_controls_section();
660
661 $this->start_controls_section(
662 'section_pa_docs',
663 array(
664 'label' => __( 'Help & Docs', 'premium-addons-for-elementor' ),
665 )
666 );
667
668 $docs = array(
669 'https://premiumaddons.com/docs/elementor-svg-draw-widget/' => __( 'Getting started »', 'premium-addons-for-elementor' ),
670 'https://www.youtube.com/watch?v=omoI4jHHvHQ' => __( 'Video tutorial »', 'premium-addons-for-elementor' ),
671 );
672
673 $doc_index = 1;
674 foreach ( $docs as $url => $title ) {
675
676 $doc_url = Helper_Functions::get_campaign_link( $url, 'svg-widget', 'wp-editor', 'get-support' );
677
678 $this->add_control(
679 'doc_' . $doc_index,
680 array(
681 'type' => Controls_Manager::RAW_HTML,
682 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc_url, $title ),
683 'content_classes' => 'editor-pa-doc',
684 )
685 );
686
687 ++$doc_index;
688
689 }
690
691 Helper_Functions::register_element_feedback_controls( $this );
692
693 $this->end_controls_section();
694
695 /*Start Icon Style*/
696 $this->start_controls_section(
697 'icon_style',
698 array(
699 'label' => __( 'Icon', 'premium-addons-for-elementor' ),
700 'tab' => Controls_Manager::TAB_STYLE,
701 )
702 );
703
704 $this->add_control(
705 'icon_color',
706 array(
707 'label' => __( 'Stroke Color', 'premium-addons-for-elementor' ),
708 'type' => Controls_Manager::COLOR,
709 'default' => '#6EC1E4',
710 'selectors' => array(
711 '{{WRAPPER}} .premium-svg-draw svg' => 'color: {{VALUE}};',
712 '{{WRAPPER}} .premium-svg-draw svg *' => 'stroke: {{VALUE}}',
713 ),
714 )
715 );
716
717 $this->add_control(
718 'fill_color',
719 array(
720 'label' => __( 'Fill Color', 'premium-addons-for-elementor' ),
721 'type' => Controls_Manager::COLOR,
722 'selectors' => array(
723 '{{WRAPPER}} .premium-svg-draw svg path, {{WRAPPER}} .premium-svg-draw svg circle, {{WRAPPER}} .premium-svg-draw svg square, {{WRAPPER}} .premium-svg-draw svg ellipse, {{WRAPPER}} .premium-svg-draw svg rect, {{WRAPPER}} .premium-svg-draw svg polyline, {{WRAPPER}} .premium-svg-draw svg line' => 'fill: {{VALUE}}',
724 ),
725 )
726 );
727
728 $this->add_control(
729 'svg_stroke',
730 array(
731 'label' => __( 'After Draw Stroke Color', 'premium-addons-for-elementor' ),
732 'type' => Controls_Manager::COLOR,
733 'global' => false,
734 'condition' => array(
735 'animate_icon' => 'yes',
736 'svg_fill' => 'yes',
737 'magic_scroll!' => 'yes',
738 ),
739 'frontend_available' => true,
740 )
741 );
742
743 $this->add_control(
744 'svg_color',
745 array(
746 'label' => __( 'After Draw Fill Color', 'premium-addons-for-elementor' ),
747 'type' => Controls_Manager::COLOR,
748 'global' => false,
749 'condition' => array(
750 'animate_icon' => 'yes',
751 'svg_fill' => 'yes',
752 'magic_scroll!' => 'yes',
753 ),
754 'frontend_available' => true,
755 )
756 );
757
758 $this->add_responsive_control(
759 'path_width',
760 array(
761 'label' => __( 'Path Thickness', 'premium-addons-for-elementor' ),
762 'type' => Controls_Manager::SLIDER,
763 'range' => array(
764 'px' => array(
765 'min' => 0,
766 'max' => 20,
767 'step' => 0.1,
768 ),
769 ),
770 'default' => array(
771 'size' => 3,
772 'unit' => 'px',
773 ),
774 'selectors' => array(
775 '{{WRAPPER}} .premium-svg-draw svg path, {{WRAPPER}} .premium-svg-draw svg circle, {{WRAPPER}} .premium-svg-draw svg square, {{WRAPPER}} .premium-svg-draw svg ellipse, {{WRAPPER}} .premium-svg-draw svg rect, {{WRAPPER}} .premium-svg-draw svg polyline, {{WRAPPER}} .premium-svg-draw svg line' => 'stroke-width: {{SIZE}}',
776 ),
777 )
778 );
779
780 $this->add_control(
781 'path_dashes',
782 array(
783 'label' => __( 'Space Between Dashes', 'premium-addons-for-elementor' ),
784 'type' => Controls_Manager::SLIDER,
785 'range' => array(
786 'px' => array(
787 'min' => 0,
788 'max' => 10,
789 'step' => 0.1,
790 ),
791 ),
792 'condition' => array(
793 'animate_icon!' => 'yes',
794 ),
795 'selectors' => array(
796 '{{WRAPPER}} .premium-svg-draw svg path, {{WRAPPER}} .premium-svg-draw svg circle, {{WRAPPER}} .premium-svg-draw svg square, {{WRAPPER}} .premium-svg-draw svg ellipse, {{WRAPPER}} .premium-svg-draw svg rect, {{WRAPPER}} .premium-svg-draw svg polyline, {{WRAPPER}} .premium-svg-draw svg line' => 'stroke-dasharray: {{SIZE}}',
797 ),
798 )
799 );
800
801 $this->add_group_control(
802 Premium_Background::get_type(),
803 array(
804 'name' => 'icon_background',
805 'types' => array( 'classic', 'gradient' ),
806 'selector' => '{{WRAPPER}} .premium-svg-draw svg',
807 )
808 );
809
810 $this->add_group_control(
811 Group_Control_Border::get_type(),
812 array(
813 'name' => 'icon_box',
814 'selector' => '{{WRAPPER}} .premium-svg-draw svg',
815 )
816 );
817
818 $this->add_control(
819 'icon_radius',
820 array(
821 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
822 'type' => Controls_Manager::SLIDER,
823 'size_units' => array( 'px', '%', 'em' ),
824 'selectors' => array(
825 '{{WRAPPER}} .premium-svg-draw svg' => 'border-radius: {{SIZE}}{{UNIT}};',
826 ),
827 'condition' => array(
828 'icon_adv_radius!' => 'yes',
829 ),
830 )
831 );
832
833 $this->add_control(
834 'icon_adv_radius',
835 array(
836 'label' => __( 'Advanced Border Radius', 'premium-addons-for-elementor' ),
837 'type' => Controls_Manager::SWITCHER,
838 'description' => __( 'Apply custom radius values. Get the radius value from ', 'premium-addons-for-elementor' ) . '<a href="https://9elements.github.io/fancy-border-radius/" target="_blank">here</a>' . __( '. See ', 'premium-addons-for-elementor' ) . '<a href="https://www.youtube.com/watch?v=S0BJazLHV-M" target="_blank">tutorial</a>',
839 )
840 );
841
842 $this->add_control(
843 'icon_adv_radius_value',
844 array(
845 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
846 'type' => Controls_Manager::TEXT,
847 'dynamic' => array( 'active' => true ),
848 'selectors' => array(
849 '{{WRAPPER}} .premium-svg-draw svg' => 'border-radius: {{VALUE}};',
850 ),
851 'condition' => array(
852 'icon_adv_radius' => 'yes',
853 ),
854 'ai' => array(
855 'active' => false,
856 ),
857 )
858 );
859
860 $this->add_group_control(
861 Group_Control_Text_Shadow::get_type(),
862 array(
863 'label' => __( 'Shadow', 'premium-addons-for-elementor' ),
864 'name' => 'icon_shadow',
865 'selector' => '{{WRAPPER}} .premium-svg-draw svg',
866 )
867 );
868
869 $this->add_control(
870 'blend_mode',
871 array(
872 'label' => __( 'Blend Mode', 'premium-addons-for-elementor' ),
873 'type' => Controls_Manager::SELECT,
874 'options' => array(
875 '' => __( 'Normal', 'premium-addons-for-elementor' ),
876 'multiply' => 'Multiply',
877 'screen' => 'Screen',
878 'overlay' => 'Overlay',
879 'darken' => 'Darken',
880 'lighten' => 'Lighten',
881 'color-dodge' => 'Color Dodge',
882 'saturation' => 'Saturation',
883 'color' => 'Color',
884 'luminosity' => 'Luminosity',
885 ),
886 'selectors' => array(
887 '{{WRAPPER}} .premium-svg-draw' => 'mix-blend-mode: {{VALUE}}',
888 ),
889 )
890 );
891
892 $this->add_responsive_control(
893 'icon_padding',
894 array(
895 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
896 'type' => Controls_Manager::DIMENSIONS,
897 'size_units' => array( 'px', 'em', '%' ),
898 'selectors' => array(
899 '{{WRAPPER}} .premium-svg-draw svg' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
900 ),
901 )
902 );
903
904 $this->end_controls_section();
905 }
906
907 /**
908 * Render SVG Draw widget output on the frontend.
909 *
910 * Written in PHP and used to generate the final HTML.
911 *
912 * @since 1.0.0
913 * @access protected
914 */
915 protected function render() {
916
917 $settings = $this->get_settings_for_display();
918
919 $type = $settings['icon_type'];
920
921 $has_link = ! empty( $settings['link']['url'] );
922
923 if ( $has_link ) {
924 $this->add_link_attributes( 'link', $settings['link'] );
925 }
926
927 ?>
928
929 <div class="premium-svg-draw elementor-invisible">
930
931 <?php if ( $has_link ) : ?>
932 <a <?php $this->print_render_attribute_string( 'link' ); ?>>
933 <?php endif; ?>
934
935 <?php if ( 'icon' === $type ) : ?>
936
937 <?php
938 $this->add_render_attribute(
939 'fa_icon',
940 array(
941 'id' => 'premium-svg-icon-' . $this->get_id(),
942 'class' => array(
943 'premium-svg-icon',
944 $settings['font_icon']['value'],
945 ),
946 'aria-hidden' => 'true',
947 'data-start' => 'manual',
948 )
949 );
950
951 echo Helper_Functions::get_svg_by_icon( $settings['font_icon'], array( 'class' => 'premium-svg-icon' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- get_svg_by_icon() returns sanitized inline SVG/icon markup.
952
953 ?>
954
955 <?php else : ?>
956
957 <?php echo Helper_Functions::sanitize_svg( $this->get_settings_for_display( 'custom_svg' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitize_svg() returns wp_kses-sanitized SVG markup. ?>
958
959 <?php endif; ?>
960
961 <?php if ( $has_link ) : ?>
962 </a>
963 <?php endif; ?>
964
965 </div>
966
967 <?php
968 }
969 }
970