PluginProbe ʕ •ᴥ•ʔ
Premium Addons for Elementor – Powerful Elementor Templates & Widgets / 4.11.32
Premium Addons for Elementor – Powerful Elementor Templates & Widgets v4.11.32
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-button.php
premium-addons-for-elementor / widgets Last commit date
dep 9 months ago premium-banner.php 9 months ago premium-blog.php 9 months ago premium-button.php 9 months ago premium-carousel.php 9 months ago premium-contactform.php 9 months ago premium-countdown.php 9 months ago premium-counter.php 9 months ago premium-dual-header.php 9 months ago premium-fancytext.php 9 months ago premium-grid.php 9 months ago premium-icon-list.php 9 months ago premium-image-button.php 9 months ago premium-image-scroll.php 9 months ago premium-image-separator.php 9 months ago premium-lottie.php 9 months ago premium-maps.php 9 months ago premium-media-wheel.php 9 months ago premium-mobile-menu.php 9 months ago premium-modalbox.php 9 months ago premium-nav-menu.php 9 months ago premium-notifications.php 9 months ago premium-person.php 9 months ago premium-pinterest-feed.php 9 months ago premium-post-ticker.php 9 months ago premium-pricing-table.php 9 months ago premium-progressbar.php 9 months ago premium-search-form.php 9 months ago premium-svg-drawer.php 9 months ago premium-tcloud.php 9 months ago premium-testimonials.php 9 months ago premium-textual-showcase.php 9 months ago premium-tiktok-feed.php 9 months ago premium-title.php 9 months ago premium-videobox.php 9 months ago premium-vscroll.php 9 months ago premium-weather.php 9 months ago premium-world-clock.php 9 months ago
premium-button.php
1932 lines
1 <?php
2 /**
3 * Premium Button.
4 */
5
6 namespace PremiumAddons\Widgets;
7
8 // Elementor Classes.
9 use Elementor\Plugin;
10 use Elementor\Icons_Manager;
11 use Elementor\Widget_Base;
12 use Elementor\Controls_Manager;
13 use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
14 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
15 use Elementor\Group_Control_Border;
16 use Elementor\Group_Control_Typography;
17 use Elementor\Group_Control_Text_Shadow;
18 use Elementor\Group_Control_Box_Shadow;
19
20 // PremiumAddons Classes.
21 use PremiumAddons\Admin\Includes\Admin_Helper;
22 use PremiumAddons\Includes\Helper_Functions;
23 use PremiumAddons\Includes\Controls\Premium_Post_Filter;
24
25 if ( ! defined( 'ABSPATH' ) ) {
26 exit; // If this file is called directly, abort.
27 }
28
29 /**
30 * Class Premium_Button
31 */
32 class Premium_Button extends Widget_Base {
33
34 /**
35 * Check if the icon draw is enabled.
36 *
37 * @since 4.9.26
38 * @access private
39 *
40 * @var bool
41 */
42 private $is_draw_enabled = null;
43
44 /**
45 * Check Icon Draw Option.
46 *
47 * @since 4.9.26
48 * @access public
49 */
50 public function check_icon_draw() {
51
52 if ( null === $this->is_draw_enabled ) {
53 $this->is_draw_enabled = Admin_Helper::check_svg_draw( 'premium-button' );
54 }
55
56 return $this->is_draw_enabled;
57 }
58
59 /**
60 * Retrieve Widget Name.
61 *
62 * @since 1.0.0
63 * @access public
64 */
65 public function get_name() {
66 return 'premium-addon-button';
67 }
68
69 /**
70 * Retrieve Widget Title.
71 *
72 * @since 1.0.0
73 * @access public
74 */
75 public function get_title() {
76 return __( 'Button', 'premium-addons-for-elementor' );
77 }
78
79 /**
80 * Retrieve Widget Icon.
81 *
82 * @since 1.0.0
83 * @access public
84 *
85 * @return string widget icon.
86 */
87 public function get_icon() {
88 return 'pa-button';
89 }
90
91 /**
92 * Retrieve Widget Dependent CSS.
93 *
94 * @since 1.0.0
95 * @access public
96 *
97 * @return array CSS style handles.
98 */
99 public function get_style_depends() {
100 return array(
101 'pa-glass',
102 'pa-btn',
103 'premium-addons',
104 );
105 }
106
107 /**
108 * Retrieve Widget Dependent JS.
109 *
110 * @since 1.0.0
111 * @access public
112 *
113 * @return array JS script handles.
114 */
115 public function get_script_depends() {
116
117 $draw_scripts = $this->check_icon_draw() ? array(
118 'pa-tweenmax',
119 'pa-motionpath',
120 ) : array();
121
122 return array_merge(
123 $draw_scripts,
124 array(
125 'lottie-js',
126 'pa-glass',
127 'premium-addons',
128 )
129 );
130 }
131
132 /**
133 * Retrieve Widget Keywords.
134 *
135 * @since 1.0.0
136 * @access public
137 *
138 * @return string Widget keywords.
139 */
140 public function get_keywords() {
141 return array( 'pa', 'premium', 'premium button', 'cta', 'call', 'link', 'btn', 'pa', 'premium' );
142 }
143
144 protected function is_dynamic_content(): bool {
145 return false;
146 }
147
148 /**
149 * Retrieve Widget Categories.
150 *
151 * @since 1.5.1
152 * @access public
153 *
154 * @return array Widget categories.
155 */
156 public function get_categories() {
157 return array( 'premium-elements' );
158 }
159
160 /**
161 * Retrieve Widget Support URL.
162 *
163 * @access public
164 *
165 * @return string support URL.
166 */
167 public function get_custom_help_url() {
168 return 'https://premiumaddons.com/support/';
169 }
170
171 public function has_widget_inner_wrapper(): bool {
172 return ! Helper_Functions::check_elementor_experiment( 'e_optimized_markup' );
173 }
174
175 /**
176 * Register Button controls.
177 *
178 * @since 1.0.0
179 * @access protected
180 */
181 protected function register_controls() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
182
183 $draw_icon = $this->check_icon_draw();
184
185 $this->start_controls_section(
186 'premium_button_general_section',
187 array(
188 'label' => __( 'Button', 'premium-addons-for-elementor' ),
189 )
190 );
191
192 $demo = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-button-widget/', 'button', 'wp-editor', 'demo' );
193 Helper_Functions::add_templates_controls( $this, 'button', $demo );
194
195 $this->add_control(
196 'premium_button_text',
197 array(
198 'label' => __( 'Text', 'premium-addons-for-elementor' ),
199 'type' => Controls_Manager::TEXT,
200 'dynamic' => array( 'active' => true ),
201 'default' => __( 'Premium Addons', 'premium-addons-for-elementor' ),
202 'label_block' => true,
203 )
204 );
205
206 $this->add_control(
207 'premium_button_link_selection',
208 array(
209 'label' => __( 'Link Type', 'premium-addons-for-elementor' ),
210 'type' => Controls_Manager::SELECT,
211 'options' => array(
212 'url' => __( 'URL', 'premium-addons-for-elementor' ),
213 'link' => __( 'Existing Page', 'premium-addons-for-elementor' ),
214 ),
215 'default' => 'url',
216 'label_block' => true,
217 )
218 );
219
220 $this->add_control(
221 'premium_button_link',
222 array(
223 'label' => __( 'Link', 'premium-addons-for-elementor' ),
224 'type' => Controls_Manager::URL,
225 'dynamic' => array( 'active' => true ),
226 'default' => array(
227 'url' => '#',
228 ),
229 'placeholder' => 'https://premiumaddons.com/',
230 'label_block' => true,
231 'condition' => array(
232 'premium_button_link_selection' => 'url',
233 ),
234 )
235 );
236
237 $this->add_control(
238 'premium_button_existing_link',
239 array(
240 'label' => __( 'Existing Page', 'premium-addons-for-elementor' ),
241 'type' => Premium_Post_Filter::TYPE,
242 'label_block' => true,
243 'multiple' => false,
244 'source' => array( 'post', 'page' ),
245 'condition' => array(
246 'premium_button_link_selection' => 'link',
247 ),
248 )
249 );
250
251 $this->add_control(
252 'premium_button_hover_effect',
253 array(
254 'label' => __( 'Hover Effect', 'premium-addons-for-elementor' ),
255 'type' => Controls_Manager::SELECT,
256 'default' => 'none',
257 'options' => array(
258 'none' => __( 'None', 'premium-addons-for-elementor' ),
259 'style1' => __( 'Slide', 'premium-addons-for-elementor' ),
260 'style2' => __( 'Shutter', 'premium-addons-for-elementor' ),
261 'style3' => __( 'Icon Fade', 'premium-addons-for-elementor' ),
262 'style4' => __( 'Icon Slide', 'premium-addons-for-elementor' ),
263 'style5' => __( 'In & Out', 'premium-addons-for-elementor' ),
264 'style6' => __( 'Grow', 'premium-addons-for-elementor' ),
265 'style7' => __( 'Double Layers', 'premium-addons-for-elementor' ),
266 'style8' => __( 'Animated Underline', 'premium-addons-for-elementor' ),
267 ),
268 'separator' => 'before',
269 'label_block' => true,
270 )
271 );
272
273 $this->add_control(
274 'underline_style',
275 array(
276 'label' => __( 'Underline Style', 'premium-addons-for-elementor' ),
277 'type' => Controls_Manager::SELECT,
278 'default' => 'line1',
279 'options' => array(
280 'line1' => __( 'Style 1', 'premium-addons-for-elementor' ),
281 'line2' => __( 'Style 2', 'premium-addons-for-elementor' ),
282 'line3' => __( 'Style 3', 'premium-addons-for-elementor' ),
283 'line4' => __( 'Style 4', 'premium-addons-for-elementor' ),
284 'line5' => __( 'Style 5', 'premium-addons-for-elementor' ),
285 'line6' => __( 'Style 6', 'premium-addons-for-elementor' ),
286 'line7' => __( 'Style 7', 'premium-addons-for-elementor' ),
287 ),
288 'condition' => array(
289 'premium_button_hover_effect' => 'style8',
290 ),
291 'label_block' => true,
292 )
293 );
294
295 $this->add_responsive_control(
296 'line_width',
297 array(
298 'label' => __( 'Line Width (%)', 'premium-addons-for-elementor' ),
299 'type' => Controls_Manager::SLIDER,
300 'condition' => array(
301 'premium_button_hover_effect' => 'style8',
302 'underline_style' => array( 'line1', 'line3', 'line5' ),
303 ),
304 'default' => array(
305 'size' => 100,
306 ),
307 'selectors' => array(
308 '{{WRAPPER}} .premium-btn-svg, {{WRAPPER}} .premium-button-line5::before, {{WRAPPER}} .premium-button-line5::after' => 'width: {{SIZE}}%',
309 ),
310 )
311 );
312
313 $this->add_responsive_control(
314 'line_height',
315 array(
316 'label' => __( 'Line Height (PX)', 'premium-addons-for-elementor' ),
317 'type' => Controls_Manager::SLIDER,
318 'condition' => array(
319 'premium_button_hover_effect' => 'style8',
320 'underline_style!' => array( 'line1', 'line3', 'line4' ),
321 ),
322 'selectors' => array(
323 '{{WRAPPER}} .premium-button-line2::before, {{WRAPPER}} .premium-button-line5::before, {{WRAPPER}} .premium-button-line5::after, {{WRAPPER}} .premium-button-line6::before, {{WRAPPER}} .premium-button-line7::before' => 'height: {{SIZE}}px',
324 ),
325 )
326 );
327
328 $this->add_responsive_control(
329 'line_h_position',
330 array(
331 'label' => __( 'Line Horizontal Position (%)', 'premium-addons-for-elementor' ),
332 'type' => Controls_Manager::SLIDER,
333 'condition' => array(
334 'premium_button_hover_effect' => 'style8',
335 'underline_style' => array( 'line3', 'line5' ),
336 ),
337 'selectors' => array(
338 '{{WRAPPER}} .premium-btn-line-wrap, {{WRAPPER}} .premium-button-line5::before, {{WRAPPER}} .premium-button-line5::after' => 'left: {{SIZE}}%',
339 ),
340 )
341 );
342
343 $this->add_responsive_control(
344 'line_v_position',
345 array(
346 'label' => __( 'Line Vertical Position (%)', 'premium-addons-for-elementor' ),
347 'type' => Controls_Manager::SLIDER,
348 'condition' => array(
349 'premium_button_hover_effect' => 'style8',
350 ),
351 'selectors' => array(
352 '{{WRAPPER}} .premium-btn-line-wrap, {{WRAPPER}} .premium-button-line2::before, {{WRAPPER}} .premium-button-line5::before, {{WRAPPER}} .premium-button-line6::before, {{WRAPPER}} .premium-button-line7::before' => 'top: {{SIZE}}%',
353 '{{WRAPPER}} .premium-button-line5::after' => 'top: calc( ( {{SIZE}}% + 2px ) + {{line_height.SIZE}}px )',
354 ),
355 )
356 );
357
358 $this->add_control(
359 'premium_button_style1_dir',
360 array(
361 'label' => __( 'Slide Direction', 'premium-addons-for-elementor' ),
362 'type' => Controls_Manager::SELECT,
363 'default' => 'bottom',
364 'options' => array(
365 'bottom' => __( 'Top to Bottom', 'premium-addons-for-elementor' ),
366 'top' => __( 'Bottom to Top', 'premium-addons-for-elementor' ),
367 'left' => __( 'Right to Left', 'premium-addons-for-elementor' ),
368 'right' => __( 'Left to Right', 'premium-addons-for-elementor' ),
369 ),
370 'condition' => array(
371 'premium_button_hover_effect' => 'style1',
372 ),
373 'label_block' => true,
374 )
375 );
376
377 $this->add_control(
378 'premium_button_style2_dir',
379 array(
380 'label' => __( 'Shutter Direction', 'premium-addons-for-elementor' ),
381 'type' => Controls_Manager::SELECT,
382 'default' => 'shutouthor',
383 'options' => array(
384 'shutinhor' => __( 'Shutter in Horizontal', 'premium-addons-for-elementor' ),
385 'shutinver' => __( 'Shutter in Vertical', 'premium-addons-for-elementor' ),
386 'shutoutver' => __( 'Shutter out Horizontal', 'premium-addons-for-elementor' ),
387 'shutouthor' => __( 'Shutter out Vertical', 'premium-addons-for-elementor' ),
388 'scshutoutver' => __( 'Scaled Shutter Vertical', 'premium-addons-for-elementor' ),
389 'scshutouthor' => __( 'Scaled Shutter Horizontal', 'premium-addons-for-elementor' ),
390 'dshutinver' => __( 'Tilted Left', 'premium-addons-for-elementor' ),
391 'dshutinhor' => __( 'Tilted Right', 'premium-addons-for-elementor' ),
392 ),
393 'condition' => array(
394 'premium_button_hover_effect' => 'style2',
395 ),
396 'label_block' => true,
397 )
398 );
399
400 $this->add_control(
401 'premium_button_style4_dir',
402 array(
403 'label' => __( 'Slide Direction', 'premium-addons-for-elementor' ),
404 'type' => Controls_Manager::SELECT,
405 'default' => 'bottom',
406 'options' => array(
407 'top' => __( 'Bottom to Top', 'premium-addons-for-elementor' ),
408 'bottom' => __( 'Top to Bottom', 'premium-addons-for-elementor' ),
409 'left' => __( 'Left to Right', 'premium-addons-for-elementor' ),
410 'right' => __( 'Right to Left', 'premium-addons-for-elementor' ),
411 ),
412 'label_block' => true,
413 'condition' => array(
414 'premium_button_hover_effect' => array( 'style4', 'style7' ),
415 ),
416 )
417 );
418
419 $this->add_control(
420 'premium_button_style5_dir',
421 array(
422 'label' => __( 'Style', 'premium-addons-for-elementor' ),
423 'type' => Controls_Manager::SELECT,
424 'default' => 'radialin',
425 'options' => array(
426 'radialin' => __( 'Radial In', 'premium-addons-for-elementor' ),
427 'radialout' => __( 'Radial Out', 'premium-addons-for-elementor' ),
428 'rectin' => __( 'Rectangle In', 'premium-addons-for-elementor' ),
429 'rectout' => __( 'Rectangle Out', 'premium-addons-for-elementor' ),
430 ),
431 'condition' => array(
432 'premium_button_hover_effect' => 'style5',
433 ),
434 'label_block' => true,
435 )
436 );
437
438 $this->add_responsive_control(
439 'grow_size',
440 array(
441 'label' => __( 'Grow Layer Size', 'premium-addons-for-elementor' ),
442 'type' => Controls_Manager::SLIDER,
443 'range' => array(
444 'px' => array(
445 'min' => 0,
446 'max' => 500,
447 ),
448 ),
449 'condition' => array(
450 'premium_button_hover_effect' => 'style6',
451 'mouse_detect!' => 'yes',
452 ),
453 'selectors' => array(
454 '{{WRAPPER}} .premium-button.premium-button-style6:before' => 'width: {{SIZE}}px; height: {{SIZE}}px',
455 ),
456 )
457 );
458
459 $this->add_responsive_control(
460 'grow_speed',
461 array(
462 'label' => __( 'Grow Animation Speed (Sec)', 'premium-addons-for-elementor' ),
463 'type' => Controls_Manager::SLIDER,
464 'range' => array(
465 'px' => array(
466 'min' => 0,
467 'max' => 3,
468 'step' => 0.1,
469 ),
470 ),
471 'condition' => array(
472 'premium_button_hover_effect' => 'style6',
473 'mouse_detect!' => 'yes',
474 ),
475 'selectors' => array(
476 '{{WRAPPER}} .premium-button.premium-button-style6:before' => 'transition-duration: {{SIZE}}s',
477 ),
478 )
479 );
480
481 $this->add_control(
482 'mouse_detect',
483 array(
484 'label' => __( 'Detect Mouse Position', 'premium-addons-for-elementor' ),
485 'type' => Controls_Manager::SWITCHER,
486 'prefix_class' => 'premium-mouse-detect-',
487 'render_type' => 'template',
488 'separator' => 'after',
489 'condition' => array(
490 'premium_button_hover_effect' => 'style6',
491 ),
492 )
493 );
494
495 $this->add_control(
496 'premium_button_icon_switcher',
497 array(
498 'label' => __( 'Icon', 'premium-addons-for-elementor' ),
499 'type' => Controls_Manager::SWITCHER,
500 'description' => __( 'Enable or disable button icon', 'premium-addons-for-elementor' ),
501 'condition' => array(
502 'premium_button_hover_effect!' => 'style4',
503 ),
504 )
505 );
506
507 $common_conditions = array(
508 'premium_button_icon_switcher' => 'yes',
509 'premium_button_hover_effect!' => 'style4',
510 );
511
512 $this->add_control(
513 'icon_type',
514 array(
515 'label' => __( 'Icon Type', 'premium-addons-for-elementor' ),
516 'type' => Controls_Manager::SELECT,
517 'options' => array(
518 'icon' => __( 'Icon', 'premium-addons-for-elementor' ),
519 'animation' => __( 'Lottie Animation', 'premium-addons-for-elementor' ),
520 'svg' => __( 'SVG Code', 'premium-addons-for-elementor' ),
521 ),
522 'default' => 'icon',
523 'label_block' => true,
524 'condition' => $common_conditions,
525 )
526 );
527
528 $this->add_control(
529 'premium_button_icon_selection_updated',
530 array(
531 'label' => __( 'Icon', 'premium-addons-for-elementor' ),
532 'type' => Controls_Manager::ICONS,
533 'fa4compatibility' => 'premium_button_icon_selection',
534 'default' => array(
535 'value' => 'fas fa-star',
536 'library' => 'fa-solid',
537 ),
538 'condition' => array_merge(
539 $common_conditions,
540 array(
541 'icon_type' => 'icon',
542 )
543 ),
544 'label_block' => true,
545 )
546 );
547
548 $this->add_control(
549 'custom_svg',
550 array(
551 'label' => __( 'SVG Code', 'premium-addons-for-elementor' ),
552 'type' => Controls_Manager::TEXTAREA,
553 '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>',
554 'condition' => array_merge(
555 $common_conditions,
556 array(
557 'icon_type' => 'svg',
558 )
559 ),
560 )
561 );
562
563 $this->add_control(
564 'lottie_url',
565 array(
566 'label' => __( 'Animation JSON URL', 'premium-addons-for-elementor' ),
567 'type' => Controls_Manager::TEXT,
568 'dynamic' => array( 'active' => true ),
569 'description' => 'Get JSON code URL from <a href="https://lottiefiles.com/" target="_blank">here</a>',
570 'label_block' => true,
571 'condition' => array_merge(
572 $common_conditions,
573 array(
574 'icon_type' => 'animation',
575 )
576 ),
577 )
578 );
579
580 $animation_conds = array(
581 'terms' => array(
582 array(
583 'name' => 'premium_button_icon_switcher',
584 'value' => 'yes',
585 ),
586 array(
587 'name' => 'premium_button_hover_effect',
588 'operator' => '!==',
589 'value' => 'style4',
590 ),
591 array(
592 'relation' => 'or',
593 'terms' => array(
594 array(
595 'name' => 'icon_type',
596 'value' => 'animation',
597 ),
598 array(
599 'terms' => array(
600 array(
601 'relation' => 'or',
602 'terms' => array(
603 array(
604 'name' => 'icon_type',
605 'value' => 'icon',
606 ),
607 array(
608 'name' => 'icon_type',
609 'value' => 'svg',
610 ),
611 ),
612 ),
613 array(
614 'name' => 'draw_svg',
615 'value' => 'yes',
616 ),
617 ),
618 ),
619 ),
620 ),
621 ),
622 );
623
624 $this->add_control(
625 'draw_svg',
626 array(
627 'label' => __( 'Draw Icon', 'premium-addons-for-elementor' ),
628 'type' => Controls_Manager::SWITCHER,
629 'description' => __( 'Enable this option to make the icon drawable. See ', 'premium-addons-for-elementor' ) . '<a href="https://www.youtube.com/watch?v=ZLr0bRe0RAY" target="_blank">tutorial</a>',
630 'classes' => $draw_icon ? '' : 'editor-pa-control-disabled',
631 'condition' => array_merge(
632 $common_conditions,
633 array(
634 'icon_type' => array( 'icon', 'svg' ),
635 'premium_button_icon_selection_updated[library]!' => 'svg',
636 )
637 ),
638 )
639 );
640
641 if ( $draw_icon ) {
642
643 $this->add_control(
644 'stroke_width',
645 array(
646 'label' => __( 'Path Thickness', 'premium-addons-for-elementor' ),
647 'type' => Controls_Manager::SLIDER,
648 'range' => array(
649 'px' => array(
650 'min' => 0,
651 'max' => 50,
652 'step' => 0.1,
653 ),
654 ),
655 'condition' => array_merge(
656 $common_conditions,
657 array(
658 'icon_type' => array( 'icon', 'svg' ),
659 )
660 ),
661 'selectors' => array(
662 '{{WRAPPER}} .premium-button-text-icon-wrapper svg:not(.premium-btn-svg) *' => 'stroke-width: {{SIZE}}',
663 ),
664 )
665 );
666
667 $this->add_control(
668 'svg_sync',
669 array(
670 'label' => __( 'Draw All Paths Together', 'premium-addons-for-elementor' ),
671 'type' => Controls_Manager::SWITCHER,
672 'condition' => array_merge(
673 $common_conditions,
674 array(
675 'icon_type' => array( 'icon', 'svg' ),
676 'draw_svg' => 'yes',
677 )
678 ),
679 )
680 );
681
682 $this->add_control(
683 'frames',
684 array(
685 'label' => __( 'Speed', 'premium-addons-for-elementor' ),
686 'type' => Controls_Manager::NUMBER,
687 'description' => __( 'Larger value means longer animation duration.', 'premium-addons-for-elementor' ),
688 'default' => 5,
689 'min' => 1,
690 'max' => 100,
691 'condition' => array_merge(
692 $common_conditions,
693 array(
694 'icon_type' => array( 'icon', 'svg' ),
695 'draw_svg' => 'yes',
696 )
697 ),
698 )
699 );
700
701 } else {
702
703 Helper_Functions::get_draw_svg_notice(
704 $this,
705 'button',
706 array_merge(
707 $common_conditions,
708 array(
709 'icon_type' => array( 'icon', 'svg' ),
710 'premium_button_icon_selection_updated[library]!' => 'svg',
711 )
712 )
713 );
714
715 }
716
717 $this->add_control(
718 'lottie_loop',
719 array(
720 'label' => __( 'Loop', 'premium-addons-for-elementor' ),
721 'type' => Controls_Manager::SWITCHER,
722 'return_value' => 'true',
723 'default' => 'true',
724 'conditions' => $animation_conds,
725 )
726 );
727
728 $this->add_control(
729 'lottie_reverse',
730 array(
731 'label' => __( 'Reverse', 'premium-addons-for-elementor' ),
732 'type' => Controls_Manager::SWITCHER,
733 'return_value' => 'true',
734 'conditions' => $animation_conds,
735 )
736 );
737
738 if ( $draw_icon ) {
739 $this->add_control(
740 'start_point',
741 array(
742 'label' => __( 'Start Point (%)', 'premium-addons-for-elementor' ),
743 'type' => Controls_Manager::SLIDER,
744 'description' => __( 'Set the point that the SVG should start from.', 'premium-addons-for-elementor' ),
745 'default' => array(
746 'unit' => '%',
747 'size' => 0,
748 ),
749 'condition' => array_merge(
750 $common_conditions,
751 array(
752 'icon_type' => array( 'icon', 'svg' ),
753 'draw_svg' => 'yes',
754 'lottie_reverse!' => 'true',
755 )
756 ),
757 )
758 );
759
760 $this->add_control(
761 'end_point',
762 array(
763 'label' => __( 'End Point (%)', 'premium-addons-for-elementor' ),
764 'type' => Controls_Manager::SLIDER,
765 'description' => __( 'Set the point that the SVG should end at.', 'premium-addons-for-elementor' ),
766 'default' => array(
767 'unit' => '%',
768 'size' => 0,
769 ),
770 'condition' => array_merge(
771 $common_conditions,
772 array(
773 'icon_type' => array( 'icon', 'svg' ),
774 'draw_svg' => 'yes',
775 'lottie_reverse' => 'true',
776 )
777 ),
778
779 )
780 );
781
782 $this->add_control(
783 'svg_hover',
784 array(
785 'label' => __( 'Only Play on Hover', 'premium-addons-for-elementor' ),
786 'type' => Controls_Manager::SWITCHER,
787 'return_value' => 'true',
788 'condition' => array_merge(
789 $common_conditions,
790 array(
791 'icon_type' => array( 'icon', 'svg' ),
792 'draw_svg' => 'yes',
793 )
794 ),
795 )
796 );
797
798 $this->add_control(
799 'svg_yoyo',
800 array(
801 'label' => __( 'Yoyo Effect', 'premium-addons-for-elementor' ),
802 'type' => Controls_Manager::SWITCHER,
803 'condition' => array_merge(
804 $common_conditions,
805 array(
806 'icon_type' => array( 'icon', 'svg' ),
807 'draw_svg' => 'yes',
808 'lottie_loop' => 'true',
809 )
810 ),
811 )
812 );
813 }
814
815 $this->add_control(
816 'slide_icon_type',
817 array(
818 'label' => __( 'Icon Type', 'premium-addons-for-elementor' ),
819 'type' => Controls_Manager::SELECT,
820 'options' => array(
821 'icon' => __( 'Icon', 'premium-addons-for-elementor' ),
822 'animation' => __( 'Lottie Animation', 'premium-addons-for-elementor' ),
823 ),
824 'default' => 'icon',
825 'label_block' => true,
826 'condition' => array(
827 'premium_button_hover_effect' => 'style4',
828 ),
829 )
830 );
831
832 $this->add_control(
833 'premium_button_style4_icon_selection_updated',
834 array(
835 'label' => __( 'Icon', 'premium-addons-for-elementor' ),
836 'type' => Controls_Manager::ICONS,
837 'fa4compatibility' => 'premium_button_style4_icon_selection',
838 'default' => array(
839 'value' => 'fas fa-bars',
840 'library' => 'fa-solid',
841 ),
842 'condition' => array(
843 'slide_icon_type' => 'icon',
844 'premium_button_hover_effect' => 'style4',
845 ),
846 'label_block' => true,
847 )
848 );
849
850 $this->add_control(
851 'slide_lottie_url',
852 array(
853 'label' => __( 'Animation JSON URL', 'premium-addons-for-elementor' ),
854 'type' => Controls_Manager::TEXT,
855 'dynamic' => array( 'active' => true ),
856 'description' => 'Get JSON code URL from <a href="https://lottiefiles.com/" target="_blank">here</a>',
857 'label_block' => true,
858 'condition' => array(
859 'slide_icon_type' => 'animation',
860 'premium_button_hover_effect' => 'style4',
861 ),
862 )
863 );
864
865 $this->add_control(
866 'premium_button_icon_position',
867 array(
868 'label' => __( 'Icon Position', 'premium-addons-for-elementor' ),
869 'type' => Controls_Manager::SELECT,
870 'default' => 'before',
871 'options' => array(
872 'before' => __( 'Before', 'premium-addons-for-elementor' ),
873 'after' => __( 'After', 'premium-addons-for-elementor' ),
874 ),
875 'label_block' => true,
876 'condition' => array(
877 'premium_button_icon_switcher' => 'yes',
878 'premium_button_hover_effect!' => 'style4',
879 ),
880 )
881 );
882
883 $this->add_responsive_control(
884 'premium_button_icon_before_size',
885 array(
886 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ),
887 'type' => Controls_Manager::SLIDER,
888 'size_units' => array( 'px', 'em', 'vw' ),
889 'range' => array(
890 'px' => array(
891 'min' => 0,
892 'max' => 200,
893 ),
894 ),
895 'condition' => array(
896 'premium_button_icon_switcher' => 'yes',
897 'premium_button_hover_effect!' => 'style4',
898 ),
899 'selectors' => array(
900 '{{WRAPPER}} .premium-button-text-icon-wrapper i' => 'font-size: {{SIZE}}{{UNIT}}',
901 '{{WRAPPER}} .premium-button-text-icon-wrapper svg' => 'width: {{SIZE}}{{UNIT}} !important; height: {{SIZE}}{{UNIT}} !important',
902 ),
903 )
904 );
905
906 $this->add_responsive_control(
907 'premium_button_icon_style4_size',
908 array(
909 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ),
910 'type' => Controls_Manager::SLIDER,
911 'size_units' => array( 'px', 'em', 'vw' ),
912 'condition' => array(
913 'premium_button_hover_effect' => 'style4',
914 ),
915 'selectors' => array(
916 '{{WRAPPER}} .premium-button-style4-icon-wrapper i' => 'font-size: {{SIZE}}{{UNIT}}',
917 '{{WRAPPER}} .premium-button-style4-icon-wrapper svg' => 'width: {{SIZE}}{{UNIT}} !important; height: {{SIZE}}{{UNIT}} !important',
918 ),
919 )
920 );
921
922 $icon_spacing = is_rtl() ? 'left' : 'right';
923
924 $icon_spacing_after = is_rtl() ? 'right' : 'left';
925
926 $this->add_responsive_control(
927 'premium_button_icon_before_spacing',
928 array(
929 'label' => __( 'Icon Spacing', 'premium-addons-for-elementor' ),
930 'type' => Controls_Manager::SLIDER,
931 'condition' => array(
932 'premium_button_icon_switcher' => 'yes',
933 'premium_button_icon_position' => 'before',
934 'premium_button_hover_effect!' => array( 'style3', 'style4' ),
935 ),
936 'default' => array(
937 'size' => 15,
938 ),
939 'selectors' => array(
940 '{{WRAPPER}} .premium-button-text-icon-wrapper i, {{WRAPPER}} .premium-button-text-icon-wrapper svg' => 'margin-' . $icon_spacing . ': {{SIZE}}px',
941 ),
942 'separator' => 'after',
943 )
944 );
945
946 $this->add_responsive_control(
947 'premium_button_icon_after_spacing',
948 array(
949 'label' => __( 'Icon Spacing', 'premium-addons-for-elementor' ),
950 'type' => Controls_Manager::SLIDER,
951 'condition' => array(
952 'premium_button_icon_switcher' => 'yes',
953 'premium_button_icon_position' => 'after',
954 'premium_button_hover_effect!' => array( 'style3', 'style4' ),
955 ),
956 'default' => array(
957 'size' => 15,
958 ),
959 'selectors' => array(
960 '{{WRAPPER}} .premium-button-text-icon-wrapper i, {{WRAPPER}} .premium-button-text-icon-wrapper svg' => 'margin-' . $icon_spacing_after . ': {{SIZE}}px',
961 ),
962 'separator' => 'after',
963 )
964 );
965
966 $this->add_responsive_control(
967 'premium_button_icon_style3_before_transition',
968 array(
969 'label' => __( 'Icon Spacing', 'premium-addons-for-elementor' ),
970 'type' => Controls_Manager::SLIDER,
971 'condition' => array(
972 'premium_button_icon_switcher' => 'yes',
973 'premium_button_icon_position' => 'before',
974 'premium_button_hover_effect' => 'style3',
975 ),
976 'range' => array(
977 'px' => array(
978 'min' => -50,
979 'max' => 50,
980 ),
981 ),
982 'selectors' => array(
983 '{{WRAPPER}} .premium-button-style3-before:hover i, {{WRAPPER}} .premium-button-style3-before:hover svg' => '-webkit-transform: translateX({{SIZE}}{{UNIT}}); transform: translateX({{SIZE}}{{UNIT}})',
984 ),
985 )
986 );
987
988 $this->add_responsive_control(
989 'premium_button_icon_style3_after_transition',
990 array(
991 'label' => __( 'Icon Spacing', 'premium-addons-for-elementor' ),
992 'type' => Controls_Manager::SLIDER,
993 'condition' => array(
994 'premium_button_icon_switcher' => 'yes',
995 'premium_button_icon_position!' => 'before',
996 'premium_button_hover_effect' => 'style3',
997 ),
998 'range' => array(
999 'px' => array(
1000 'min' => -50,
1001 'max' => 50,
1002 ),
1003 ),
1004 'selectors' => array(
1005 '{{WRAPPER}} .premium-button-style3-after:hover i, {{WRAPPER}} .premium-button-style3-after:hover svg' => '-webkit-transform: translateX({{SIZE}}{{UNIT}}); transform: translateX({{SIZE}}{{UNIT}})',
1006 ),
1007 )
1008 );
1009
1010 $this->add_control(
1011 'slide_lottie_loop',
1012 array(
1013 'label' => __( 'Loop', 'premium-addons-for-elementor' ),
1014 'type' => Controls_Manager::SWITCHER,
1015 'return_value' => 'true',
1016 'default' => 'true',
1017 'condition' => array(
1018 'slide_icon_type' => 'animation',
1019 'premium_button_hover_effect' => 'style4',
1020 ),
1021 )
1022 );
1023
1024 $this->add_control(
1025 'slide_lottie_reverse',
1026 array(
1027 'label' => __( 'Reverse', 'premium-addons-for-elementor' ),
1028 'type' => Controls_Manager::SWITCHER,
1029 'return_value' => 'true',
1030 'condition' => array(
1031 'slide_icon_type' => 'animation',
1032 'premium_button_hover_effect' => 'style4',
1033 ),
1034 )
1035 );
1036
1037 $this->add_control(
1038 'premium_button_size',
1039 array(
1040 'label' => __( 'Size', 'premium-addons-for-elementor' ),
1041 'type' => Controls_Manager::SELECT,
1042 'default' => 'lg',
1043 'options' => array(
1044 'sm' => __( 'Small', 'premium-addons-for-elementor' ),
1045 'md' => __( 'Medium', 'premium-addons-for-elementor' ),
1046 'lg' => __( 'Large', 'premium-addons-for-elementor' ),
1047 'block' => __( 'Block', 'premium-addons-for-elementor' ),
1048 ),
1049 'label_block' => true,
1050 'separator' => 'before',
1051 )
1052 );
1053
1054 $this->add_responsive_control(
1055 'premium_button_align',
1056 array(
1057 'label' => __( 'Alignment', 'premium-addons-for-elementor' ),
1058 'type' => Controls_Manager::CHOOSE,
1059 'options' => array(
1060 'left' => array(
1061 'title' => __( 'Left', 'premium-addons-for-elementor' ),
1062 'icon' => 'eicon-text-align-left',
1063 ),
1064 'center' => array(
1065 'title' => __( 'Center', 'premium-addons-for-elementor' ),
1066 'icon' => 'eicon-text-align-center',
1067 ),
1068 'right' => array(
1069 'title' => __( 'Right', 'premium-addons-for-elementor' ),
1070 'icon' => 'eicon-text-align-right',
1071 ),
1072 ),
1073 'selectors' => array(
1074 '{{WRAPPER}}' => 'text-align: {{VALUE}}',
1075 ),
1076 'toggle' => false,
1077 'default' => 'center',
1078 'condition' => array(
1079 'premium_button_size!' => 'block',
1080 ),
1081 )
1082 );
1083
1084 // Allow admins only to add JS.
1085 if ( current_user_can( 'administrator' ) ) {
1086 $this->add_control(
1087 'premium_button_event_switcher',
1088 array(
1089 'label' => __( 'onclick Event', 'premium-addons-for-elementor' ),
1090 'type' => Controls_Manager::SWITCHER,
1091 )
1092 );
1093
1094 $this->add_control(
1095 'premium_button_event_function',
1096 array(
1097 'label' => __( 'Example: myFunction();', 'premium-addons-for-elementor' ),
1098 'type' => Controls_Manager::CODE,
1099 'dynamic' => array( 'active' => true ),
1100 'condition' => array(
1101 'premium_button_event_switcher' => 'yes',
1102 ),
1103 )
1104 );
1105
1106 }
1107
1108 $this->end_controls_section();
1109
1110 $this->start_controls_section(
1111 'section_pa_docs',
1112 array(
1113 'label' => __( 'Help & Docs', 'premium-addons-for-elementor' ),
1114 )
1115 );
1116
1117 $docs = array(
1118 'https://premiumaddons.com/docs/button-widget-tutorial' => __( 'Getting started »', 'premium-addons-for-elementor' ),
1119 'https://premiumaddons.com/docs/how-can-i-open-an-elementor-popup-using-premium-button' => __( 'How to open an Elementor popup using button widget »', 'premium-addons-for-elementor' ),
1120 'https://premiumaddons.com/docs/how-to-play-pause-a-soundtrack-using-premium-button-widget' => __( 'How to play/pause a soundtrack using button widget »', 'premium-addons-for-elementor' ),
1121 'https://premiumaddons.com/docs/how-to-use-elementor-widgets-to-navigate-through-carousel-widget-slides/' => __( 'How To Use Premium Button To Navigate Through Carousel Widget Slides »', 'premium-addons-for-elementor' ),
1122 );
1123
1124 $doc_index = 1;
1125 foreach ( $docs as $url => $title ) {
1126
1127 $doc_url = Helper_Functions::get_campaign_link( $url, 'button-widget', 'wp-editor', 'get-support' );
1128
1129 $this->add_control(
1130 'doc_' . $doc_index,
1131 array(
1132 'type' => Controls_Manager::RAW_HTML,
1133 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc_url, $title ),
1134 'content_classes' => 'editor-pa-doc',
1135 )
1136 );
1137
1138 ++$doc_index;
1139
1140 }
1141
1142 $this->end_controls_section();
1143
1144 Helper_Functions::register_papro_promotion_controls( $this, 'button' );
1145
1146 $this->start_controls_section(
1147 'premium_button_style_section',
1148 array(
1149 'label' => __( 'Button', 'premium-addons-for-elementor' ),
1150 'tab' => Controls_Manager::TAB_STYLE,
1151 )
1152 );
1153
1154 $this->add_responsive_control(
1155 'button_width',
1156 array(
1157 'label' => __( 'Width', 'premium-addons-for-elementor' ),
1158 'type' => Controls_Manager::SLIDER,
1159 'size_units' => array( 'px', '%', 'vw', 'custom' ),
1160 'range' => array(
1161 'px' => array(
1162 'min' => 1,
1163 'max' => 500,
1164 ),
1165 ),
1166 'selectors' => array(
1167 '{{WRAPPER}} .premium-button' => 'width: {{SIZE}}{{UNIT}};',
1168 ),
1169 'condition' => array(
1170 'premium_button_size!' => 'block',
1171 ),
1172 )
1173 );
1174
1175 if ( $draw_icon ) {
1176 $this->add_control(
1177 'svg_color',
1178 array(
1179 'label' => __( 'After Draw Fill Color', 'premium-addons-for-elementor' ),
1180 'type' => Controls_Manager::COLOR,
1181 'global' => false,
1182 'separator' => 'after',
1183 'condition' => array(
1184 'premium_button_icon_switcher' => 'yes',
1185 'icon_type' => array( 'icon', 'svg' ),
1186 'premium_button_hover_effect!' => 'style4',
1187 'draw_svg' => 'yes',
1188 ),
1189 )
1190 );
1191 }
1192
1193 $this->add_group_control(
1194 Group_Control_Typography::get_type(),
1195 array(
1196 'name' => 'premium_button_typo',
1197 'global' => array(
1198 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
1199 ),
1200 'selector' => '{{WRAPPER}} .premium-button',
1201 )
1202 );
1203
1204 $this->start_controls_tabs( 'premium_button_style_tabs' );
1205
1206 $this->start_controls_tab(
1207 'premium_button_style_normal',
1208 array(
1209 'label' => __( 'Normal', 'premium-addons-for-elementor' ),
1210 )
1211 );
1212
1213 $this->add_control(
1214 'premium_button_text_color_normal',
1215 array(
1216 'label' => __( 'Text Color', 'premium-addons-for-elementor' ),
1217 'type' => Controls_Manager::COLOR,
1218 'global' => array(
1219 'default' => Global_Colors::COLOR_SECONDARY,
1220 ),
1221 'selectors' => array(
1222 '{{WRAPPER}} .premium-button .premium-button-text-icon-wrapper span' => 'color: {{VALUE}};',
1223 ),
1224 )
1225 );
1226
1227 $this->add_control(
1228 'premium_button_icon_color_normal',
1229 array(
1230 'label' => __( 'Icon Color', 'premium-addons-for-elementor' ),
1231 'type' => Controls_Manager::COLOR,
1232 'global' => array(
1233 'default' => Global_Colors::COLOR_SECONDARY,
1234 ),
1235 'selectors' => array(
1236 '{{WRAPPER}} .premium-button-text-icon-wrapper i' => 'color: {{VALUE}}',
1237 '{{WRAPPER}} .premium-drawable-icon *, {{WRAPPER}} .premium-button-text-icon-wrapper svg:not([class*="premium-"])' => 'fill: {{VALUE}};',
1238 ),
1239 'condition' => array(
1240 'premium_button_icon_switcher' => 'yes',
1241 'icon_type' => array( 'icon', 'svg' ),
1242 'premium_button_hover_effect!' => array( 'style3', 'style4' ),
1243 ),
1244 )
1245 );
1246
1247 if ( $draw_icon ) {
1248 $this->add_control(
1249 'stroke_color',
1250 array(
1251 'label' => __( 'Stroke Color', 'premium-addons-for-elementor' ),
1252 'type' => Controls_Manager::COLOR,
1253 'global' => array(
1254 'default' => Global_Colors::COLOR_ACCENT,
1255 ),
1256 'condition' => array(
1257 'premium_button_icon_switcher' => 'yes',
1258 'icon_type' => array( 'icon', 'svg' ),
1259 'premium_button_hover_effect!' => array( 'style3', 'style4' ),
1260 ),
1261 'selectors' => array(
1262 '{{WRAPPER}} .premium-drawable-icon *, {{WRAPPER}} svg:not([class*="premium-"])' => 'stroke: {{VALUE}};',
1263 ),
1264 )
1265 );
1266 }
1267
1268 $this->add_control(
1269 'premium_button_background_normal',
1270 array(
1271 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
1272 'type' => Controls_Manager::COLOR,
1273 'global' => array(
1274 'default' => Global_Colors::COLOR_PRIMARY,
1275 ),
1276 'selectors' => array(
1277 '{{WRAPPER}} .premium-button, {{WRAPPER}} .premium-button.premium-button-style2-shutinhor:before , {{WRAPPER}} .premium-button.premium-button-style2-shutinver:before , {{WRAPPER}} .premium-button-style5-radialin:before , {{WRAPPER}} .premium-button-style5-rectin:before' => 'background-color: {{VALUE}};',
1278 ),
1279 )
1280 );
1281
1282 $this->add_control(
1283 'btn_lq_effect',
1284 array(
1285 'label' => __( 'Liquid Glass Effect', 'premium-addons-for-elementor' ),
1286 'type' => Controls_Manager::SELECT,
1287 'description' => sprintf(
1288 /* translators: 1: `<a>` opening tag, 2: `</a>` closing tag. */
1289 esc_html__( 'Important: Make sure this element has a semi-transparent background color to see the effect. See all presets from %1$shere%2$s.', 'premium-addons-for-elementor' ),
1290 '<a href="https://premiumaddons.com/liquid-glass/" target="_blank">',
1291 '</a>'
1292 ),
1293 'options' => array(
1294 'none' => __( 'None', 'premium-addons-for-elementor' ),
1295 'glass1' => __( 'Preset 01', 'premium-addons-for-elementor' ),
1296 'glass2' => __( 'Preset 02', 'premium-addons-for-elementor' ),
1297 'glass3' => apply_filters( 'pa_pro_label', __( 'Preset 03 (Pro)', 'premium-addons-for-elementor' ) ),
1298 'glass4' => apply_filters( 'pa_pro_label', __( 'Preset 04 (Pro)', 'premium-addons-for-elementor' ) ),
1299 'glass5' => apply_filters( 'pa_pro_label', __( 'Preset 05 (Pro)', 'premium-addons-for-elementor' ) ),
1300 'glass6' => apply_filters( 'pa_pro_label', __( 'Preset 06 (Pro)', 'premium-addons-for-elementor' ) ),
1301 ),
1302 'prefix_class' => 'premium-lq__',
1303 'default' => 'none',
1304 'render_type' => 'template',
1305 'label_block' => true,
1306 'condition' => array(
1307 'premium_button_hover_effect!' => array( 'style2', 'style5' ),
1308 ),
1309 )
1310 );
1311
1312 $this->add_group_control(
1313 Group_Control_Border::get_type(),
1314 array(
1315 'name' => 'premium_button_border_normal',
1316 'selector' => '{{WRAPPER}} .premium-button',
1317 )
1318 );
1319
1320 $this->add_control(
1321 'premium_button_border_radius_normal',
1322 array(
1323 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1324 'type' => Controls_Manager::SLIDER,
1325 'size_units' => array( 'px', '%', 'em' ),
1326 'selectors' => array(
1327 '{{WRAPPER}} .premium-button' => 'border-radius: {{SIZE}}{{UNIT}};',
1328 ),
1329 'condition' => array(
1330 'button_adv_radius!' => 'yes',
1331 ),
1332 )
1333 );
1334
1335 $this->add_control(
1336 'button_adv_radius',
1337 array(
1338 'label' => __( 'Advanced Border Radius', 'premium-addons-for-elementor' ),
1339 'type' => Controls_Manager::SWITCHER,
1340 '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>',
1341 )
1342 );
1343
1344 $this->add_control(
1345 'button_adv_radius_value',
1346 array(
1347 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1348 'type' => Controls_Manager::TEXT,
1349 'dynamic' => array( 'active' => true ),
1350 'selectors' => array(
1351 '{{WRAPPER}} .premium-button' => 'border-radius: {{VALUE}};',
1352 ),
1353 'condition' => array(
1354 'button_adv_radius' => 'yes',
1355 ),
1356 )
1357 );
1358
1359 $this->add_group_control(
1360 Group_Control_Text_Shadow::get_type(),
1361 array(
1362 'label' => __( 'Icon Shadow', 'premium-addons-for-elementor' ),
1363 'name' => 'premium_button_icon_shadow_normal',
1364 'selector' => '{{WRAPPER}} .premium-button-text-icon-wrapper i',
1365 'condition' => array(
1366 'premium_button_icon_switcher' => 'yes',
1367 'icon_type' => 'icon',
1368 'premium_button_hover_effect!' => array( 'style3', 'style4' ),
1369 ),
1370 )
1371 );
1372
1373 $this->add_group_control(
1374 Group_Control_Text_Shadow::get_type(),
1375 array(
1376 'label' => __( 'Text Shadow', 'premium-addons-for-elementor' ),
1377 'name' => 'premium_button_text_shadow_normal',
1378 'selector' => '{{WRAPPER}} .premium-button-text-icon-wrapper span',
1379 )
1380 );
1381
1382 $this->add_group_control(
1383 Group_Control_Box_Shadow::get_type(),
1384 array(
1385 'label' => __( 'Button Shadow', 'premium-addons-for-elementor' ),
1386 'name' => 'premium_button_box_shadow_normal',
1387 'selector' => '{{WRAPPER}} .premium-button',
1388 )
1389 );
1390
1391 $this->add_responsive_control(
1392 'premium_button_margin_normal',
1393 array(
1394 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1395 'type' => Controls_Manager::DIMENSIONS,
1396 'size_units' => array( 'px', 'em', '%', 'vw', 'custom' ),
1397 'selectors' => array(
1398 '{{WRAPPER}} .premium-button' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1399 ),
1400 )
1401 );
1402
1403 $this->add_responsive_control(
1404 'premium_button_padding_normal',
1405 array(
1406 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
1407 'type' => Controls_Manager::DIMENSIONS,
1408 'size_units' => array( 'px', 'em', '%', 'vw', 'custom' ),
1409 'selectors' => array(
1410 '{{WRAPPER}} .premium-button, {{WRAPPER}} .premium-button-line6::after' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1411 ),
1412 )
1413 );
1414
1415 $this->end_controls_tab();
1416
1417 $this->start_controls_tab(
1418 'premium_button_style_hover',
1419 array(
1420 'label' => __( 'Hover', 'premium-addons-for-elementor' ),
1421 )
1422 );
1423
1424 $this->add_control(
1425 'premium_button_text_color_hover',
1426 array(
1427 'label' => __( 'Text Color', 'premium-addons-for-elementor' ),
1428 'type' => Controls_Manager::COLOR,
1429 'global' => array(
1430 'default' => Global_Colors::COLOR_PRIMARY,
1431 ),
1432 'selectors' => array(
1433 '{{WRAPPER}} .premium-button:hover .premium-button-text-icon-wrapper span, {{WRAPPER}} .premium-button-line6::after' => 'color: {{VALUE}};',
1434 ),
1435 'condition' => array(
1436 'premium_button_hover_effect!' => 'style4',
1437 ),
1438 )
1439 );
1440
1441 $this->add_control(
1442 'premium_button_icon_color_hover',
1443 array(
1444 'label' => __( 'Icon Color', 'premium-addons-for-elementor' ),
1445 'type' => Controls_Manager::COLOR,
1446 'global' => array(
1447 'default' => Global_Colors::COLOR_PRIMARY,
1448 ),
1449 'selectors' => array(
1450 '{{WRAPPER}} .premium-button:hover .premium-button-text-icon-wrapper i' => 'color: {{VALUE}}',
1451 '{{WRAPPER}} .premium-button:hover .premium-drawable-icon *, {{WRAPPER}} .premium-button:hover svg:not([class*="premium-"])' => 'fill: {{VALUE}};',
1452 ),
1453 'condition' => array(
1454 'premium_button_icon_switcher' => 'yes',
1455 'icon_type' => array( 'icon', 'svg' ),
1456 'premium_button_hover_effect!' => 'style4',
1457 ),
1458 )
1459 );
1460
1461 $this->add_control(
1462 'underline_color',
1463 array(
1464 'label' => __( 'Line Color', 'premium-addons-for-elementor' ),
1465 'type' => Controls_Manager::COLOR,
1466 'global' => array(
1467 'default' => Global_Colors::COLOR_SECONDARY,
1468 ),
1469 'selectors' => array(
1470 '{{WRAPPER}} .premium-btn-svg' => 'stroke: {{VALUE}};',
1471 '{{WRAPPER}} .premium-button-line2::before, {{WRAPPER}} .premium-button-line4::before, {{WRAPPER}} .premium-button-line5::before, {{WRAPPER}} .premium-button-line5::after, {{WRAPPER}} .premium-button-line6::before, {{WRAPPER}} .premium-button-line7::before' => 'background-color: {{VALUE}};',
1472 ),
1473 'condition' => array(
1474 'premium_button_hover_effect' => 'style8',
1475 ),
1476 )
1477 );
1478
1479 if ( $draw_icon ) {
1480 $this->add_control(
1481 'stroke_color_hover',
1482 array(
1483 'label' => __( 'Stroke Color', 'premium-addons-for-elementor' ),
1484 'type' => Controls_Manager::COLOR,
1485 'global' => array(
1486 'default' => Global_Colors::COLOR_ACCENT,
1487 ),
1488 'condition' => array(
1489 'premium_button_icon_switcher' => 'yes',
1490 'icon_type' => array( 'icon', 'svg' ),
1491 'premium_button_hover_effect!' => 'style4',
1492 ),
1493 'selectors' => array(
1494 '{{WRAPPER}} .premium-button:hover .premium-drawable-icon *, {{WRAPPER}} .premium-button:hover svg:not([class*="premium-"])' => 'stroke: {{VALUE}};',
1495 ),
1496 )
1497 );
1498 }
1499
1500 $this->add_control(
1501 'premium_button_style4_icon_color',
1502 array(
1503 'label' => __( 'Icon Color', 'premium-addons-for-elementor' ),
1504 'type' => Controls_Manager::COLOR,
1505 'global' => array(
1506 'default' => Global_Colors::COLOR_PRIMARY,
1507 ),
1508 'selectors' => array(
1509 '{{WRAPPER}} .premium-button-style4-icon-wrapper' => 'color: {{VALUE}}',
1510 '{{WRAPPER}} .premium-button-style4-icon-wrapper svg' => 'fill: {{VALUE}}',
1511 ),
1512 'condition' => array(
1513 'premium_button_hover_effect' => 'style4',
1514 'slide_icon_type' => 'icon',
1515 ),
1516 )
1517 );
1518
1519 $this->add_control(
1520 'premium_button_background_hover',
1521 array(
1522 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
1523 'type' => Controls_Manager::COLOR,
1524 'global' => array(
1525 'default' => Global_Colors::COLOR_TEXT,
1526 ),
1527 'selectors' => array(
1528 '{{WRAPPER}} .premium-button-none:hover, {{WRAPPER}} .premium-button-style8:hover, {{WRAPPER}} .premium-button-style1:before, {{WRAPPER}} .premium-button-style2-shutouthor:before, {{WRAPPER}} .premium-button-style2-shutoutver:before, {{WRAPPER}} .premium-button-style2-shutinhor, {{WRAPPER}} .premium-button-style2-shutinver, {{WRAPPER}} .premium-button-style2-dshutinhor:before, {{WRAPPER}} .premium-button-style2-dshutinver:before, {{WRAPPER}} .premium-button-style2-scshutouthor:before, {{WRAPPER}} .premium-button-style2-scshutoutver:before, {{WRAPPER}} .premium-button-style3-after:hover, {{WRAPPER}} .premium-button-style3-before:hover, {{WRAPPER}} .premium-button-style4-icon-wrapper, {{WRAPPER}} .premium-button-style5-radialin, {{WRAPPER}} .premium-button-style5-radialout:before, {{WRAPPER}} .premium-button-style5-rectin, {{WRAPPER}} .premium-button-style5-rectout:before, {{WRAPPER}} .premium-button-style6-bg, {{WRAPPER}} .premium-button-style6:before' => 'background-color: {{VALUE}}',
1529 ),
1530 'condition' => array(
1531 'premium_button_hover_effect!' => 'style7',
1532
1533 ),
1534 )
1535 );
1536
1537 $this->add_control(
1538 'first_layer_hover',
1539 array(
1540 'label' => __( 'Layer #1 Color', 'premium-addons-for-elementor' ),
1541 'type' => Controls_Manager::COLOR,
1542 'global' => array(
1543 'default' => Global_Colors::COLOR_SECONDARY,
1544 ),
1545 'selectors' => array(
1546 '{{WRAPPER}} .premium-button-style7 .premium-button-text-icon-wrapper:before' => 'background-color: {{VALUE}}',
1547 ),
1548 'condition' => array(
1549 'premium_button_hover_effect' => 'style7',
1550
1551 ),
1552 )
1553 );
1554
1555 $this->add_control(
1556 'second_layer_hover',
1557 array(
1558 'label' => __( 'Layer #2 Color', 'premium-addons-for-elementor' ),
1559 'type' => Controls_Manager::COLOR,
1560 'global' => array(
1561 'default' => Global_Colors::COLOR_TEXT,
1562 ),
1563 'selectors' => array(
1564 '{{WRAPPER}} .premium-button-style7 .premium-button-text-icon-wrapper:after' => 'background-color: {{VALUE}}',
1565 ),
1566 'condition' => array(
1567 'premium_button_hover_effect' => 'style7',
1568 ),
1569 )
1570 );
1571
1572 $this->add_group_control(
1573 Group_Control_Border::get_type(),
1574 array(
1575 'name' => 'premium_button_border_hover',
1576 'selector' => '{{WRAPPER}} .premium-button:hover',
1577 )
1578 );
1579
1580 $this->add_control(
1581 'premium_button_border_radius_hover',
1582 array(
1583 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1584 'type' => Controls_Manager::SLIDER,
1585 'size_units' => array( 'px', '%', 'em' ),
1586 'selectors' => array(
1587 '{{WRAPPER}} .premium-button:hover' => 'border-radius: {{SIZE}}{{UNIT}};',
1588 ),
1589 'condition' => array(
1590 'button_hover_adv_radius!' => 'yes',
1591 ),
1592 )
1593 );
1594
1595 $this->add_control(
1596 'button_hover_adv_radius',
1597 array(
1598 'label' => __( 'Advanced Border Radius', 'premium-addons-for-elementor' ),
1599 'type' => Controls_Manager::SWITCHER,
1600 '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>',
1601 )
1602 );
1603
1604 $this->add_control(
1605 'button_hover_adv_radius_value',
1606 array(
1607 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1608 'type' => Controls_Manager::TEXT,
1609 'dynamic' => array( 'active' => true ),
1610 'selectors' => array(
1611 '{{WRAPPER}} .premium-button:hover' => 'border-radius: {{VALUE}};',
1612 ),
1613 'condition' => array(
1614 'button_hover_adv_radius' => 'yes',
1615 ),
1616 )
1617 );
1618
1619 $this->add_group_control(
1620 Group_Control_Text_Shadow::get_type(),
1621 array(
1622 'label' => __( 'Icon Shadow', 'premium-addons-for-elementor' ),
1623 'name' => 'premium_button_icon_shadow_hover',
1624 'selector' => '{{WRAPPER}} .premium-button:hover .premium-button-text-icon-wrapper i',
1625 'condition' => array(
1626 'premium_button_icon_switcher' => 'yes',
1627 'icon_type' => 'icon',
1628 'premium_button_hover_effect!' => 'style4',
1629 ),
1630 )
1631 );
1632
1633 $this->add_group_control(
1634 Group_Control_Text_Shadow::get_type(),
1635 array(
1636 'label' => __( 'Icon Shadow', 'premium-addons-for-elementor' ),
1637 'name' => 'premium_button_style4_icon_shadow_hover',
1638 'selector' => '{{WRAPPER}} .premium-button:hover .premium-button-style4-icon-wrapper',
1639 'condition' => array(
1640 'premium_button_hover_effect' => 'style4',
1641 'slide_icon_type' => 'icon',
1642 ),
1643 )
1644 );
1645
1646 $this->add_group_control(
1647 Group_Control_Text_Shadow::get_type(),
1648 array(
1649 'label' => __( 'Text Shadow', 'premium-addons-for-elementor' ),
1650 'name' => 'premium_button_text_shadow_hover',
1651 'selector' => '{{WRAPPER}} .premium-button:hover .premium-button-text-icon-wrapper span',
1652 'condition' => array(
1653 'premium_button_hover_effect!' => 'style4',
1654 ),
1655 )
1656 );
1657
1658 $this->add_group_control(
1659 Group_Control_Box_Shadow::get_type(),
1660 array(
1661 'label' => __( 'Button Shadow', 'premium-addons-for-elementor' ),
1662 'name' => 'premium_button_box_shadow_hover',
1663 'selector' => '{{WRAPPER}} .premium-button:hover',
1664 )
1665 );
1666
1667 $this->add_responsive_control(
1668 'premium_button_margin_hover',
1669 array(
1670 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1671 'type' => Controls_Manager::DIMENSIONS,
1672 'size_units' => array( 'px', 'em', '%', 'vw', 'custom' ),
1673 'selectors' => array(
1674 '{{WRAPPER}} .premium-button:hover' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1675 ),
1676 )
1677 );
1678
1679 $this->add_responsive_control(
1680 'premium_button_padding_hover',
1681 array(
1682 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
1683 'type' => Controls_Manager::DIMENSIONS,
1684 'size_units' => array( 'px', 'em', '%', 'vw', 'custom' ),
1685 'selectors' => array(
1686 '{{WRAPPER}} .premium-button:hover' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1687 ),
1688 )
1689 );
1690
1691 $this->end_controls_tab();
1692
1693 $this->end_controls_tabs();
1694
1695 $this->end_controls_section();
1696 }
1697
1698 /**
1699 * Render Button output on the frontend.
1700 *
1701 * Written in PHP and used to generate the final HTML.
1702 *
1703 * @since 1.0.0
1704 * @access protected
1705 */
1706 protected function render() {
1707
1708 $settings = $this->get_settings_for_display();
1709
1710 $this->add_inline_editing_attributes( 'premium_button_text' );
1711
1712 $button_text = $settings['premium_button_text'];
1713
1714 if ( 'url' === $settings['premium_button_link_selection'] ) {
1715 $button_url = $settings['premium_button_link'];
1716 } else {
1717 $button_url = get_permalink( $settings['premium_button_existing_link'] );
1718 }
1719
1720 $button_size = 'premium-btn-' . $settings['premium_button_size'];
1721
1722 if ( 'yes' === $settings['premium_button_icon_switcher'] ) {
1723
1724 $icon_type = $settings['icon_type'];
1725
1726 if ( 'icon' === $icon_type || 'svg' === $icon_type ) {
1727
1728 $this->add_render_attribute( 'icon', 'class', 'premium-drawable-icon' );
1729
1730 if ( 'yes' === $settings['draw_svg'] ) {
1731
1732 $this->add_render_attribute(
1733 'button',
1734 'class',
1735 array(
1736 'elementor-invisible',
1737 'premium-drawer-hover',
1738 )
1739 );
1740
1741 $this->add_render_attribute(
1742 'icon',
1743 array(
1744 'class' => 'premium-svg-drawer',
1745 'data-svg-reverse' => $settings['lottie_reverse'],
1746 'data-svg-loop' => $settings['lottie_loop'],
1747 'data-svg-sync' => $settings['svg_sync'],
1748 'data-svg-hover' => $settings['svg_hover'],
1749 'data-svg-fill' => $settings['svg_color'],
1750 'data-svg-frames' => $settings['frames'],
1751 'data-svg-yoyo' => $settings['svg_yoyo'],
1752 'data-svg-point' => $settings['lottie_reverse'] ? $settings['end_point']['size'] : $settings['start_point']['size'],
1753 )
1754 );
1755
1756 } else {
1757 $this->add_render_attribute( 'icon', 'class', 'premium-svg-nodraw' );
1758 }
1759 } else {
1760 $this->add_render_attribute(
1761 'lottie',
1762 array(
1763 'class' => 'premium-lottie-animation',
1764 'data-lottie-url' => $settings['lottie_url'],
1765 'data-lottie-loop' => $settings['lottie_loop'],
1766 'data-lottie-reverse' => $settings['lottie_reverse'],
1767 )
1768 );
1769 }
1770 }
1771
1772 if ( 'none' === $settings['premium_button_hover_effect'] ) {
1773 $style_dir = 'premium-button-none';
1774 } elseif ( 'style1' === $settings['premium_button_hover_effect'] ) {
1775 $style_dir = 'premium-button-style1-' . $settings['premium_button_style1_dir'];
1776 } elseif ( 'style2' === $settings['premium_button_hover_effect'] ) {
1777 $style_dir = 'premium-button-style2-' . $settings['premium_button_style2_dir'];
1778 } elseif ( 'style3' === $settings['premium_button_hover_effect'] ) {
1779 $style_dir = 'premium-button-style3-' . $settings['premium_button_icon_position'];
1780 } elseif ( 'style4' === $settings['premium_button_hover_effect'] ) {
1781 $style_dir = 'premium-button-style4-' . $settings['premium_button_style4_dir'];
1782
1783 $slide_icon_type = $settings['slide_icon_type'];
1784
1785 if ( 'icon' !== $slide_icon_type ) {
1786
1787 $this->add_render_attribute(
1788 'slide_lottie',
1789 array(
1790 'class' => 'premium-lottie-animation',
1791 'data-lottie-url' => $settings['slide_lottie_url'],
1792 'data-lottie-loop' => $settings['slide_lottie_loop'],
1793 'data-lottie-reverse' => $settings['slide_lottie_reverse'],
1794 )
1795 );
1796
1797 }
1798 } elseif ( 'style5' === $settings['premium_button_hover_effect'] ) {
1799 $style_dir = 'premium-button-style5-' . $settings['premium_button_style5_dir'];
1800 } elseif ( 'style6' === $settings['premium_button_hover_effect'] ) {
1801 $style_dir = 'premium-button-style6';
1802 $mouse_detect = $settings['mouse_detect'];
1803 $this->add_render_attribute( 'style6', 'class', 'premium-button-style6-bg' );
1804 } elseif ( 'style7' === $settings['premium_button_hover_effect'] ) {
1805 $style_dir = 'premium-button-style7-' . $settings['premium_button_style4_dir'];
1806 } else {
1807 $style_dir = 'premium-button-' . $settings['underline_style'];
1808
1809 $this->add_render_attribute( 'button', 'data-text', $button_text );
1810 }
1811
1812 $this->add_render_attribute(
1813 'button',
1814 'class',
1815 array(
1816 'premium-button',
1817 'premium-button-' . $settings['premium_button_hover_effect'],
1818 $button_size,
1819 $style_dir,
1820 )
1821 );
1822
1823 if ( ! empty( $button_url ) ) {
1824
1825 if ( 'url' === $settings['premium_button_link_selection'] ) {
1826 $this->add_link_attributes( 'button', $button_url );
1827 } else {
1828 $this->add_render_attribute( 'button', 'href', $button_url );
1829 }
1830 }
1831
1832 if ( isset( $settings['premium_button_event_switcher'] ) ) {
1833 $button_event = $settings['premium_button_event_function'];
1834 if ( 'yes' === $settings['premium_button_event_switcher'] && ! empty( $button_event ) ) {
1835
1836 if ( Helper_Functions::check_capability( 'unfiltered_html' ) ) {
1837 $this->add_render_attribute( 'button', 'onclick', ( $button_event ) );
1838 }
1839 }
1840 }
1841
1842 ?>
1843
1844
1845 <a <?php echo wp_kses_post( $this->get_render_attribute_string( 'button' ) ); ?>>
1846 <div class="premium-button-text-icon-wrapper">
1847 <?php if ( 'yes' === $settings['premium_button_icon_switcher'] ) : ?>
1848
1849 <?php if ( 'before' === $settings['premium_button_icon_position'] && 'style4' !== $settings['premium_button_hover_effect'] ) : ?>
1850 <?php if ( 'icon' === $icon_type ) : ?>
1851 <?php
1852
1853 echo Helper_Functions::get_svg_by_icon(
1854 $settings['premium_button_icon_selection_updated'],
1855 $this->get_render_attribute_string( 'icon' )
1856 );// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1857
1858 ?>
1859 <?php elseif ( 'svg' === $icon_type ) : ?>
1860 <div <?php echo wp_kses_post( $this->get_render_attribute_string( 'icon' ) ); ?>>
1861 <?php $this->print_unescaped_setting( 'custom_svg' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
1862 </div>
1863 <?php else : ?>
1864 <div <?php echo wp_kses_post( $this->get_render_attribute_string( 'lottie' ) ); ?>></div>
1865 <?php endif; ?>
1866 <?php endif; ?>
1867 <?php endif; ?>
1868
1869 <?php if ( ! empty( $button_text ) ) : ?>
1870 <span <?php echo wp_kses_post( $this->get_render_attribute_string( 'premium_button_text' ) ); ?>>
1871 <?php echo wp_kses_post( $button_text ); ?>
1872 </span>
1873 <?php endif; ?>
1874
1875 <?php if ( 'yes' === $settings['premium_button_icon_switcher'] ) : ?>
1876 <?php if ( 'after' === $settings['premium_button_icon_position'] && 'style4' !== $settings['premium_button_hover_effect'] ) : ?>
1877 <?php if ( 'icon' === $icon_type ) : ?>
1878 <?php
1879 echo Helper_Functions::get_svg_by_icon(
1880 $settings['premium_button_icon_selection_updated'],
1881 $this->get_render_attribute_string( 'icon' )
1882 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1883 ?>
1884 <?php elseif ( 'svg' === $icon_type ) : ?>
1885 <div <?php echo wp_kses_post( $this->get_render_attribute_string( 'icon' ) ); ?>>
1886 <?php $this->print_unescaped_setting( 'custom_svg' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
1887 </div>
1888 <?php else : ?>
1889 <div <?php echo wp_kses_post( $this->get_render_attribute_string( 'lottie' ) ); ?>></div>
1890 <?php endif; ?>
1891 <?php endif; ?>
1892 <?php endif; ?>
1893 </div>
1894
1895 <?php if ( 'style4' === $settings['premium_button_hover_effect'] ) : ?>
1896 <div class="premium-button-style4-icon-wrapper <?php echo esc_attr( $settings['premium_button_style4_dir'] ); ?>">
1897 <?php if ( 'icon' === $slide_icon_type ) : ?>
1898 <?php
1899
1900 Icons_Manager::render_icon( $settings['premium_button_style4_icon_selection_updated'], array( 'aria-hidden' => 'true' ) );
1901 ?>
1902 <?php else : ?>
1903 <div <?php echo wp_kses_post( $this->get_render_attribute_string( 'slide_lottie' ) ); ?>></div>
1904 <?php endif; ?>
1905 </div>
1906 <?php endif; ?>
1907
1908 <?php if ( 'style6' === $settings['premium_button_hover_effect'] && 'yes' === $mouse_detect ) : ?>
1909 <span <?php echo wp_kses_post( $this->get_render_attribute_string( 'style6' ) ); ?>></span>
1910 <?php endif; ?>
1911
1912 <?php if ( 'style8' === $settings['premium_button_hover_effect'] ) : ?>
1913 <?php echo Helper_Functions::get_btn_svgs( $settings['underline_style'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
1914 <?php endif; ?>
1915
1916 </a>
1917
1918
1919 <?php
1920 }
1921
1922 /**
1923 * Render Button widget output in the editor.
1924 *
1925 * Written as a Backbone JavaScript template and used to generate the live preview.
1926 *
1927 * @since 1.0.0
1928 * @access protected
1929 */
1930 protected function content_template() {}
1931 }
1932