PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.17.4
Shortcodes and extra features for Phlox theme v2.17.4
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / elementor / widgets / button.php
auxin-elements / includes / elementor / widgets Last commit date
theme-elements 1 year ago accordion.php 1 year ago audio.php 4 years ago before-after.php 3 years ago button.php 1 year ago carousel-navigation.php 4 years ago circle-chart.php 1 year ago contact-box.php 4 years ago contact-form.php 1 year ago custom-list.php 1 year ago divider.php 4 years ago gallery.php 1 year ago gmap.php 4 years ago heading-modern.php 1 year ago icon.php 1 year ago image.php 1 year ago mailchimp.php 1 year ago modern-button.php 1 year ago products-grid.php 1 year ago quote.php 1 year ago recent-comments.php 1 year ago recent-posts-grid-carousel.php 1 year ago recent-posts-land-style.php 1 year ago recent-posts-masonry.php 1 year ago recent-posts-tiles-carousel.php 1 year ago recent-posts-tiles.php 1 year ago recent-posts-timeline.php 1 year ago recent-products.php 1 year ago responsive-table.php 1 year ago search.php 4 years ago staff.php 1 year ago svg.php 1 year ago tabs.php 1 year ago testimonial.php 1 year ago text.php 1 year ago touch-slider.php 1 year ago video.php 4 years ago
button.php
615 lines
1 <?php
2 namespace Auxin\Plugin\CoreElements\Elementor\Elements;
3
4 use Elementor\Plugin;
5 use Elementor\Widget_Base;
6 use Elementor\Controls_Manager;
7 use Elementor\Group_Control_Typography;
8 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
9 use Elementor\Group_Control_Background;
10 use Elementor\Group_Control_Box_Shadow;
11 use Elementor\Group_Control_Text_Shadow;
12
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit; // Exit if accessed directly.
16 }
17
18 /**
19 * Elementor 'Button' widget.
20 *
21 * Elementor widget that displays an 'Button' with lightbox.
22 *
23 * @since 1.0.0
24 */
25 class Button extends Widget_Base {
26
27 /**
28 * Get widget name.
29 *
30 * Retrieve 'Button' widget name.
31 *
32 * @since 1.0.0
33 * @access public
34 *
35 * @return string Widget name.
36 */
37 public function get_name() {
38 return 'aux_button';
39 }
40
41 /**
42 * Get widget title.
43 *
44 * Retrieve 'Button' widget title.
45 *
46 * @since 1.0.0
47 * @access public
48 *
49 * @return string Widget title.
50 */
51 public function get_title() {
52 return __('Button', 'auxin-elements' );
53 }
54
55 /**
56 * Get widget icon.
57 *
58 * Retrieve 'Button' widget icon.
59 *
60 * @since 1.0.0
61 * @access public
62 *
63 * @return string Widget icon.
64 */
65 public function get_icon() {
66 return 'eicon-button auxin-badge';
67 }
68
69 /**
70 * Get widget categories.
71 *
72 * Retrieve 'Button' widget icon.
73 *
74 * @since 1.0.0
75 * @access public
76 *
77 * @return string Widget icon.
78 */
79 public function get_categories() {
80 return array( 'auxin-core' );
81 }
82
83 /**
84 * Register 'Button' widget controls.
85 *
86 * Adds different input fields to allow the user to change and customize the widget settings.
87 *
88 * @since 1.0.0
89 * @access protected
90 */
91 protected function register_controls() {
92
93 /*-----------------------------------------------------------------------------------*/
94 /* button_section
95 /*-----------------------------------------------------------------------------------*/
96
97 $this->start_controls_section(
98 'button_section',
99 array(
100 'label' => __('Button', 'auxin-elements' ),
101 )
102 );
103
104 $this->add_control(
105 'label',
106 array(
107 'label' => __('Button label','auxin-elements' ),
108 'type' => Controls_Manager::TEXT,
109 'default' => 'Read More'
110 )
111 );
112
113 $this->add_control(
114 'link',
115 array(
116 'label' => __('Link','auxin-elements' ),
117 'description' => __('If you want to link your button.', 'auxin-elements' ),
118 'type' => Controls_Manager::URL,
119 'placeholder' => 'https://your-link.com',
120 'show_external' => true,
121 'dynamic' => array(
122 'active' => true
123 )
124 )
125 );
126
127 $this->add_control(
128 'open_video_in_lightbox',
129 array(
130 'label' => __('Open Video in Lightbox','auxin-elements' ),
131 'type' => Controls_Manager::SWITCHER,
132 'label_on' => __( 'On', 'auxin-elements' ),
133 'label_off' => __( 'Off', 'auxin-elements' ),
134 'return_value' => 'yes',
135 'default' => ''
136 )
137 );
138
139 $this->end_controls_section();
140
141 /*-----------------------------------------------------------------------------------*/
142 /* general_section
143 /*-----------------------------------------------------------------------------------*/
144
145 $this->start_controls_section(
146 'general_section',
147 array(
148 'label' => __('Wrapper', 'auxin-elements' ),
149 'tab' => Controls_Manager::TAB_STYLE,
150 )
151 );
152
153 $this->add_control(
154 'size',
155 array(
156 'label' => __('Button size', 'auxin-elements'),
157 'type' => Controls_Manager::SELECT,
158 'default' => 'medium',
159 'options' => array(
160 'exlarge' => __('Exlarge', 'auxin-elements' ),
161 'large' => __('Large' , 'auxin-elements' ),
162 'medium' => __('Medium' , 'auxin-elements' ),
163 'small' => __('Small' , 'auxin-elements' ),
164 'tiny' => __('Tiny' , 'auxin-elements' )
165 )
166 )
167 );
168
169 $this->add_control(
170 'uppercase',
171 array(
172 'label' => __('Uppercase label','auxin-elements' ),
173 'type' => Controls_Manager::SWITCHER,
174 'label_on' => __( 'On', 'auxin-elements' ),
175 'label_off' => __( 'Off', 'auxin-elements' ),
176 'return_value' => 'yes',
177 'default' => 'yes'
178 )
179 );
180
181 $this->add_control(
182 'border',
183 array(
184 'label' => __('Button shape','auxin-elements' ),
185 'type' => 'aux-visual-select',
186 'options' => array(
187 'none' => array(
188 'label' => __('Box', 'auxin-elements' ),
189 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg'
190 ),
191 'round' => array(
192 'label' => __('Round', 'auxin-elements' ),
193 'image' => AUXIN_URL . 'images/visual-select/button-curved.svg'
194 ),
195 'curve' => array(
196 'label' => __('Curve', 'auxin-elements' ),
197 'image' => AUXIN_URL . 'images/visual-select/button-rounded.svg'
198 )
199 ),
200 'default' => 'none'
201 )
202 );
203
204 $this->add_control(
205 'style',
206 array(
207 'label' => __('Button style','auxin-elements' ),
208 'type' => 'aux-visual-select',
209 'options' => array(
210 'none' => array(
211 'label' => __('Normal', 'auxin-elements' ),
212 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg'
213 ),
214 '3d' => array(
215 'label' => __('3D', 'auxin-elements' ),
216 'image' => AUXIN_URL . 'images/visual-select/button-3d.svg'
217 ),
218 'outline' => array(
219 'label' => __('Outline', 'auxin-elements' ),
220 'image' => AUXIN_URL . 'images/visual-select/button-outline.svg'
221 )
222 ),
223 'default' => 'none'
224 )
225 );
226
227 $this->add_responsive_control(
228 'align',
229 array(
230 'label' => __('Align','auxin-elements'),
231 'type' => Controls_Manager::CHOOSE,
232 'options' => array(
233 'left' => array(
234 'title' => __( 'Left', 'auxin-elements' ),
235 'icon' => 'eicon-text-align-left',
236 ),
237 'center' => array(
238 'title' => __( 'Center', 'auxin-elements' ),
239 'icon' => 'eicon-text-align-center',
240 ),
241 'right' => array(
242 'title' => __( 'Right', 'auxin-elements' ),
243 'icon' => 'eicon-text-align-right',
244 ),
245 ),
246 'default' => 'center',
247 'toggle' => true,
248 'selectors' => array(
249 '{{WRAPPER}}' => 'text-align: {{VALUE}}',
250 )
251 )
252 );
253
254 $this->add_responsive_control(
255 'button_padding',
256 array(
257 'label' => __( 'Padding', 'auxin-elements' ),
258 'type' => Controls_Manager::DIMENSIONS,
259 'size_units' => array( 'px', '%' ),
260 'selectors' => array(
261 '{{WRAPPER}} .aux-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
262 )
263 )
264 );
265
266 $this->end_controls_section();
267
268 /*-----------------------------------------------------------------------------------*/
269 /* sking_section
270 /*-----------------------------------------------------------------------------------*/
271
272 $this->start_controls_section(
273 'sking_section',
274 array(
275 'label' => __('Skin', 'auxin-elements' ),
276 'tab' => Controls_Manager::TAB_STYLE,
277 )
278 );
279
280 $this->add_control(
281 'color_name',
282 array(
283 'label' => __('Skin', 'auxin-elements'),
284 'type' => 'aux-visual-select',
285 'default' => 'carmine-pink',
286 'options' => auxin_get_famous_colors_list()
287 )
288 );
289
290 $this->start_controls_tabs( 'button_background' );
291
292 $this->start_controls_tab(
293 'button_bg_normal',
294 array(
295 'label' => __( 'Normal' , 'auxin-elements' )
296 )
297 );
298
299 $this->add_group_control(
300 Group_Control_Background::get_type(),
301 array(
302 'name' => 'background',
303 'label' => __( 'Background', 'auxin-elements' ),
304 'types' => array( 'classic', 'gradient' ),
305 'selector' => '{{WRAPPER}} .aux-button',
306 )
307 );
308
309 $this->add_group_control(
310 Group_Control_Box_Shadow::get_type(),
311 array(
312 'name' => 'box_shadow',
313 'selector' => '{{WRAPPER}} .aux-button'
314 )
315 );
316
317 $this->end_controls_tab();
318
319 $this->start_controls_tab(
320 'button_bg_hover',
321 array(
322 'label' => __( 'Hover' , 'auxin-elements' )
323 )
324 );
325
326 $this->add_group_control(
327 Group_Control_Background::get_type(),
328 array(
329 'name' => 'hover_background',
330 'label' => __( 'Background', 'auxin-elements' ),
331 'types' => array( 'classic', 'gradient' ),
332 'selector' => '{{WRAPPER}} .aux-button .aux-overlay::after',
333 )
334 );
335
336 $this->add_group_control(
337 Group_Control_Box_Shadow::get_type(),
338 array(
339 'name' => 'hover_box_shadow',
340 'selector' => '{{WRAPPER}} .aux-button:hover'
341 )
342 );
343
344 $this->end_controls_tab();
345
346 $this->end_controls_tabs();
347
348 $this->end_controls_section();
349
350 /*-----------------------------------------------------------------------------------*/
351 /* icon_section
352 /*-----------------------------------------------------------------------------------*/
353
354 $this->start_controls_section(
355 'icon_section',
356 array(
357 'label' => __('Icon', 'auxin-elements' ),
358 'tab' => Controls_Manager::TAB_STYLE,
359 )
360 );
361
362 $this->add_control(
363 'aux_button_icon',
364 array(
365 'label' => __('Icon for button','auxin-elements' ),
366 'type' => Controls_Manager::ICONS,
367 )
368 );
369
370 $this->add_control(
371 'icon_align',
372 array(
373 'label' => __('Icon alignment', 'auxin-elements'),
374 'type' => Controls_Manager::SELECT,
375 'default' => 'default',
376 'options' => array(
377 'default' => __('Default' , 'auxin-elements' ),
378 'left' => __('Left' , 'auxin-elements' ),
379 'right' => __('Right' , 'auxin-elements' ),
380 'over' => __('Over' , 'auxin-elements' ),
381 'left-animate' => __('Animate from Left' , 'auxin-elements' ),
382 'right-animate' => __('Animate from Right' , 'auxin-elements' )
383 )
384 )
385 );
386
387 $this->add_responsive_control(
388 'btn_icon_size',
389 array(
390 'label' => __( 'Icon Size', 'auxin-elements' ),
391 'type' => Controls_Manager::SLIDER,
392 'size_units' => array( 'px', '%' ),
393 'range' => array(
394 'px' => array(
395 'min' => 10,
396 'max' => 512,
397 'step' => 2,
398 ),
399 '%' => array(
400 'min' => 0,
401 'max' => 100,
402 ),
403 ),
404 'selectors' => array(
405 '{{WRAPPER}} .aux-icon' => 'font-size: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
406 )
407 )
408 );
409
410 $this->add_responsive_control(
411 'icon_margin',
412 array(
413 'label' => __( 'Icon Margin', 'auxin-elements' ),
414 'type' => Controls_Manager::DIMENSIONS,
415 'size_units' => array( 'px', '%' ),
416 'selectors' => array(
417 '{{WRAPPER}} .aux-icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
418 )
419 )
420 );
421
422 $this->start_controls_tabs( 'button_icon_color' );
423
424 $this->start_controls_tab(
425 'icon_color_normal',
426 array(
427 'label' => __( 'Normal' , 'auxin-elements' )
428 )
429 );
430
431 $this->add_control(
432 'icon_color',
433 array(
434 'label' => __( 'Color', 'auxin-elements' ),
435 'type' => Controls_Manager::COLOR,
436 'selectors' => array(
437 '{{WRAPPER}} .aux-icon' => 'color: {{VALUE}}; fill: {{VALUE}};',
438 )
439 )
440 );
441
442 $this->end_controls_tab();
443
444 $this->start_controls_tab(
445 'icon_color_hover',
446 array(
447 'label' => __( 'Hover' , 'auxin-elements' )
448 )
449 );
450
451 $this->add_control(
452 'hover_icon_color',
453 array(
454 'label' => __( 'Color', 'auxin-elements' ),
455 'type' => Controls_Manager::COLOR,
456 'selectors' => array(
457 '{{WRAPPER}} .aux-button:hover .aux-icon' => 'color: {{VALUE}};fill: {{VALUE}};',
458 )
459 )
460 );
461
462 $this->end_controls_tab();
463
464 $this->end_controls_tabs();
465
466 $this->add_responsive_control(
467 'icon_padding',
468 array(
469 'label' => __( 'Padding', 'auxin-elements' ),
470 'type' => Controls_Manager::DIMENSIONS,
471 'size_units' => array( 'px', '%' ),
472 'selectors' => array(
473 '{{WRAPPER}} .aux-icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
474 )
475 )
476 );
477
478 $this->end_controls_section();
479
480 /*-----------------------------------------------------------------------------------*/
481 /* text_section
482 /*-----------------------------------------------------------------------------------*/
483
484 $this->start_controls_section(
485 'text_section',
486 array(
487 'label' => __('Text', 'auxin-elements' ),
488 'tab' => Controls_Manager::TAB_STYLE,
489 )
490 );
491
492 $this->start_controls_tabs( 'button_text' );
493
494 $this->start_controls_tab(
495 'button_text_normal',
496 array(
497 'label' => __( 'Normal' , 'auxin-elements' )
498 )
499 );
500
501 $this->add_control(
502 'text_color',
503 array(
504 'label' => __( 'Color', 'auxin-elements' ),
505 'type' => Controls_Manager::COLOR,
506 'selectors' => array(
507 '{{WRAPPER}} .aux-text' => 'color: {{VALUE}};',
508 )
509 )
510 );
511
512 $this->add_group_control(
513 Group_Control_Text_Shadow::get_type(),
514 array(
515 'name' => 'text_shadow',
516 'label' => __( 'Text Shadow', 'auxin-elements' ),
517 'selector' => '{{WRAPPER}} .aux-button',
518 )
519 );
520
521 $this->add_group_control(
522 Group_Control_Typography::get_type(),
523 array(
524 'name' => 'text_typography',
525 'global' => [
526 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
527 ],
528 'selector' => '{{WRAPPER}} .aux-text'
529 )
530 );
531
532 $this->end_controls_tab();
533
534 $this->start_controls_tab(
535 'button_text_hover',
536 array(
537 'label' => __( 'Hover' , 'auxin-elements' )
538 )
539 );
540
541 $this->add_control(
542 'hover_text_color',
543 array(
544 'label' => __( 'Color', 'auxin-elements' ),
545 'type' => Controls_Manager::COLOR,
546 'selectors' => array(
547 '{{WRAPPER}} .aux-button:hover .aux-text' => 'color: {{VALUE}};',
548 )
549 )
550 );
551
552 $this->add_group_control(
553 Group_Control_Text_Shadow::get_type(),
554 array(
555 'name' => 'hover_text_shadow',
556 'label' => __( 'Text Shadow', 'auxin-elements' ),
557 'selector' => '{{WRAPPER}} .aux-button:hover',
558 )
559 );
560
561 $this->add_group_control(
562 Group_Control_Typography::get_type(),
563 array(
564 'name' => 'hover_text_typography',
565 'global' => [
566 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
567 ],
568 'selector' => '{{WRAPPER}} .aux-text'
569 )
570 );
571
572 $this->end_controls_tab();
573
574 $this->end_controls_tabs();
575
576 $this->end_controls_section();
577 }
578
579 /**
580 * Render image box widget output on the frontend.
581 *
582 * Written in PHP and used to generate the final HTML.
583 *
584 * @since 1.0.0
585 * @access protected
586 */
587 protected function render() {
588
589 $settings = $this->get_settings_for_display();
590
591 $icon_value = ! empty( $settings['aux_button_icon']['value'] ) ? $settings['aux_button_icon'] : ( ! empty( $settings['icon'] ) ? $settings['icon'] : '' ) ;
592
593 $btn_target = $settings['link']['is_external'] ? '_blank' : '_self';
594
595 $args = array(
596 'label' => $settings['label'],
597 'size' => $settings['size'],
598 'border' => $settings['border'],
599 'style' => $settings['style'],
600 'uppercase' => $settings['uppercase'],
601 'icon' => $icon_value,
602 'icon_align' => $settings['icon_align'],
603 'color_name' => $settings['color_name'],
604 'link' => $settings['link']['url'],
605 'nofollow' => $settings['link']['nofollow'],
606 'target' => $btn_target,
607 'open_video_in_lightbox' => $settings['open_video_in_lightbox'],
608 );
609
610 // get the shortcode base blog page
611 echo auxin_widget_button_callback( $args );
612
613 }
614
615 }