PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.17.14
Shortcodes and extra features for Phlox theme v2.17.14
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 6 months ago accordion.php 6 months ago audio.php 6 months ago before-after.php 6 months ago button.php 6 months ago carousel-navigation.php 6 months ago circle-chart.php 6 months ago contact-box.php 6 months ago contact-form.php 6 months ago custom-list.php 6 months ago divider.php 6 months ago gallery.php 6 months ago gmap.php 6 months ago heading-modern.php 6 months ago icon.php 6 months ago image.php 6 months ago mailchimp.php 6 months ago modern-button.php 6 months ago products-grid.php 6 months ago quote.php 6 months ago recent-comments.php 6 months ago recent-posts-grid-carousel.php 6 months ago recent-posts-land-style.php 6 months ago recent-posts-masonry.php 6 months ago recent-posts-tiles-carousel.php 6 months ago recent-posts-tiles.php 6 months ago recent-posts-timeline.php 6 months ago recent-products.php 6 months ago responsive-table.php 6 months ago search.php 6 months ago staff.php 6 months ago svg.php 6 months ago tabs.php 6 months ago testimonial.php 6 months ago text.php 6 months ago touch-slider.php 6 months ago video.php 6 months ago
button.php
656 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 public function has_widget_inner_wrapper(): bool {
56 return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
57 }
58
59
60 /**
61 * Get widget icon.
62 *
63 * Retrieve 'Button' widget icon.
64 *
65 * @since 1.0.0
66 * @access public
67 *
68 * @return string Widget icon.
69 */
70 public function get_icon() {
71 return 'eicon-button auxin-badge';
72 }
73
74 /**
75 * Get widget categories.
76 *
77 * Retrieve 'Button' widget icon.
78 *
79 * @since 1.0.0
80 * @access public
81 *
82 * @return string Widget icon.
83 */
84 public function get_categories() {
85 return array( 'auxin-core' );
86 }
87
88 /**
89 * Register 'Button' widget controls.
90 *
91 * Adds different input fields to allow the user to change and customize the widget settings.
92 *
93 * @since 1.0.0
94 * @access protected
95 */
96 protected function register_controls() {
97
98 /*-----------------------------------------------------------------------------------*/
99 /* button_section
100 /*-----------------------------------------------------------------------------------*/
101
102 $this->start_controls_section(
103 'button_section',
104 array(
105 'label' => __('Button', 'auxin-elements' ),
106 )
107 );
108
109 $this->add_control(
110 'label',
111 array(
112 'label' => __('Button label','auxin-elements' ),
113 'type' => Controls_Manager::TEXT,
114 'default' => 'Read More'
115 )
116 );
117
118 $this->add_control(
119 'link',
120 array(
121 'label' => __('Link','auxin-elements' ),
122 'description' => __('If you want to link your button.', 'auxin-elements' ),
123 'type' => Controls_Manager::URL,
124 'placeholder' => 'https://your-link.com',
125 'show_external' => true,
126 'dynamic' => array(
127 'active' => true
128 )
129 )
130 );
131
132 $this->add_control(
133 'open_video_in_lightbox',
134 array(
135 'label' => __('Open Video in Lightbox','auxin-elements' ),
136 'type' => Controls_Manager::SWITCHER,
137 'label_on' => __( 'On', 'auxin-elements' ),
138 'label_off' => __( 'Off', 'auxin-elements' ),
139 'return_value' => 'yes',
140 'default' => ''
141 )
142 );
143
144 $this->end_controls_section();
145
146 /*-----------------------------------------------------------------------------------*/
147 /* general_section
148 /*-----------------------------------------------------------------------------------*/
149
150 $this->start_controls_section(
151 'general_section',
152 array(
153 'label' => __('Wrapper', 'auxin-elements' ),
154 'tab' => Controls_Manager::TAB_STYLE,
155 )
156 );
157
158 $this->add_control(
159 'size',
160 array(
161 'label' => __('Button size', 'auxin-elements'),
162 'type' => Controls_Manager::SELECT,
163 'default' => 'medium',
164 'options' => array(
165 'exlarge' => __('Exlarge', 'auxin-elements' ),
166 'large' => __('Large' , 'auxin-elements' ),
167 'medium' => __('Medium' , 'auxin-elements' ),
168 'small' => __('Small' , 'auxin-elements' ),
169 'tiny' => __('Tiny' , 'auxin-elements' )
170 )
171 )
172 );
173
174 $this->add_control(
175 'uppercase',
176 array(
177 'label' => __('Uppercase label','auxin-elements' ),
178 'type' => Controls_Manager::SWITCHER,
179 'label_on' => __( 'On', 'auxin-elements' ),
180 'label_off' => __( 'Off', 'auxin-elements' ),
181 'return_value' => 'yes',
182 'default' => 'yes'
183 )
184 );
185
186 $this->add_control(
187 'border',
188 array(
189 'label' => __('Button shape','auxin-elements' ),
190 'type' => 'aux-visual-select',
191 'options' => array(
192 'none' => array(
193 'label' => __('Box', 'auxin-elements' ),
194 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg'
195 ),
196 'round' => array(
197 'label' => __('Round', 'auxin-elements' ),
198 'image' => AUXIN_URL . 'images/visual-select/button-curved.svg'
199 ),
200 'curve' => array(
201 'label' => __('Curve', 'auxin-elements' ),
202 'image' => AUXIN_URL . 'images/visual-select/button-rounded.svg'
203 )
204 ),
205 'default' => 'none'
206 )
207 );
208
209 $this->add_control(
210 'style',
211 array(
212 'label' => __('Button style','auxin-elements' ),
213 'type' => 'aux-visual-select',
214 'options' => array(
215 'none' => array(
216 'label' => __('Normal', 'auxin-elements' ),
217 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg'
218 ),
219 '3d' => array(
220 'label' => __('3D', 'auxin-elements' ),
221 'image' => AUXIN_URL . 'images/visual-select/button-3d.svg'
222 ),
223 'outline' => array(
224 'label' => __('Outline', 'auxin-elements' ),
225 'image' => AUXIN_URL . 'images/visual-select/button-outline.svg'
226 )
227 ),
228 'default' => 'none'
229 )
230 );
231
232 $this->add_responsive_control(
233 'align',
234 array(
235 'label' => __('Align','auxin-elements'),
236 'type' => Controls_Manager::CHOOSE,
237 'options' => array(
238 'left' => array(
239 'title' => __( 'Left', 'auxin-elements' ),
240 'icon' => 'eicon-text-align-left',
241 ),
242 'center' => array(
243 'title' => __( 'Center', 'auxin-elements' ),
244 'icon' => 'eicon-text-align-center',
245 ),
246 'right' => array(
247 'title' => __( 'Right', 'auxin-elements' ),
248 'icon' => 'eicon-text-align-right',
249 ),
250 ),
251 'default' => 'center',
252 'toggle' => true,
253 'selectors' => array(
254 '{{WRAPPER}}' => 'text-align: {{VALUE}}',
255 )
256 )
257 );
258
259 $this->add_responsive_control(
260 'button_padding',
261 array(
262 'label' => __( 'Padding', 'auxin-elements' ),
263 'type' => Controls_Manager::DIMENSIONS,
264 'size_units' => array( 'px', '%' ),
265 'selectors' => array(
266 '{{WRAPPER}} .aux-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
267 )
268 )
269 );
270
271 $this->end_controls_section();
272
273 /*-----------------------------------------------------------------------------------*/
274 /* sking_section
275 /*-----------------------------------------------------------------------------------*/
276
277 $this->start_controls_section(
278 'sking_section',
279 array(
280 'label' => __('Skin', 'auxin-elements' ),
281 'tab' => Controls_Manager::TAB_STYLE,
282 )
283 );
284
285 $this->add_control(
286 'color_name',
287 array(
288 'label' => __('Skin', 'auxin-elements'),
289 'type' => 'aux-visual-select',
290 'default' => 'carmine-pink',
291 'options' => auxin_get_famous_colors_list()
292 )
293 );
294
295 $this->start_controls_tabs( 'button_background' );
296
297 $this->start_controls_tab(
298 'button_bg_normal',
299 array(
300 'label' => __( 'Normal' , 'auxin-elements' )
301 )
302 );
303
304 $this->add_group_control(
305 Group_Control_Background::get_type(),
306 array(
307 'name' => 'background',
308 'label' => __( 'Background', 'auxin-elements' ),
309 'types' => array( 'classic', 'gradient' ),
310 'selector' => '{{WRAPPER}} .aux-button',
311 )
312 );
313
314 $this->add_group_control(
315 Group_Control_Box_Shadow::get_type(),
316 array(
317 'name' => 'box_shadow',
318 'selector' => '{{WRAPPER}} .aux-button'
319 )
320 );
321
322 $this->end_controls_tab();
323
324 $this->start_controls_tab(
325 'button_bg_hover',
326 array(
327 'label' => __( 'Hover' , 'auxin-elements' )
328 )
329 );
330
331 $this->add_control(
332 'fading_hover',
333 array(
334 'label' => __('Fade hover','auxin-elements' ),
335 'type' => Controls_Manager::SWITCHER,
336 'label_on' => __( 'Yes', 'auxin-elements' ),
337 'label_off' => __( 'No', 'auxin-elements' ),
338 'return_value' => 'yes',
339 'default' => 'no',
340 'selectors_dictionary' => [
341 'no' => '',
342 'yes' => 'display: none;',
343 ],
344 'selectors' => [
345 '{{WRAPPER}} .aux-button .aux-overlay::after' => '{{value}}'
346 ]
347 )
348 );
349
350 $this->add_group_control(
351 Group_Control_Background::get_type(),
352 array(
353 'name' => 'fading_hover_background',
354 'label' => __( 'Background', 'auxin-elements' ),
355 'types' => array( 'classic', 'gradient' ),
356 'selector' => '{{WRAPPER}} .aux-button:hover',
357 'condition' => [
358 'fading_hover' => 'yes'
359 ]
360 )
361 );
362
363 $this->add_group_control(
364 Group_Control_Background::get_type(),
365 array(
366 'name' => 'hover_background',
367 'label' => __( 'Background', 'auxin-elements' ),
368 'types' => array( 'classic', 'gradient' ),
369 'selector' => '{{WRAPPER}} .aux-button .aux-overlay::after',
370 'condition' => [
371 'fading_hover!' => 'yes'
372 ]
373 )
374 );
375
376 $this->add_group_control(
377 Group_Control_Box_Shadow::get_type(),
378 array(
379 'name' => 'hover_box_shadow',
380 'selector' => '{{WRAPPER}} .aux-button:hover'
381 )
382 );
383
384 $this->end_controls_tab();
385
386 $this->end_controls_tabs();
387
388 $this->end_controls_section();
389
390 /*-----------------------------------------------------------------------------------*/
391 /* icon_section
392 /*-----------------------------------------------------------------------------------*/
393
394 $this->start_controls_section(
395 'icon_section',
396 array(
397 'label' => __('Icon', 'auxin-elements' ),
398 'tab' => Controls_Manager::TAB_STYLE,
399 )
400 );
401
402 $this->add_control(
403 'aux_button_icon',
404 array(
405 'label' => __('Icon for button','auxin-elements' ),
406 'type' => Controls_Manager::ICONS,
407 )
408 );
409
410 $this->add_control(
411 'icon_align',
412 array(
413 'label' => __('Icon alignment', 'auxin-elements'),
414 'type' => Controls_Manager::SELECT,
415 'default' => 'default',
416 'options' => array(
417 'default' => __('Default' , 'auxin-elements' ),
418 'left' => __('Left' , 'auxin-elements' ),
419 'right' => __('Right' , 'auxin-elements' ),
420 'over' => __('Over' , 'auxin-elements' ),
421 'left-animate' => __('Animate from Left' , 'auxin-elements' ),
422 'right-animate' => __('Animate from Right' , 'auxin-elements' )
423 )
424 )
425 );
426
427 $this->add_responsive_control(
428 'btn_icon_size',
429 array(
430 'label' => __( 'Icon Size', 'auxin-elements' ),
431 'type' => Controls_Manager::SLIDER,
432 'size_units' => array( 'px', '%' ),
433 'range' => array(
434 'px' => array(
435 'min' => 10,
436 'max' => 512,
437 'step' => 2,
438 ),
439 '%' => array(
440 'min' => 0,
441 'max' => 100,
442 ),
443 ),
444 'selectors' => array(
445 '{{WRAPPER}} .aux-icon' => 'font-size: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
446 )
447 )
448 );
449
450 $this->add_responsive_control(
451 'icon_margin',
452 array(
453 'label' => __( 'Icon Margin', 'auxin-elements' ),
454 'type' => Controls_Manager::DIMENSIONS,
455 'size_units' => array( 'px', '%' ),
456 'selectors' => array(
457 '{{WRAPPER}} .aux-icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
458 )
459 )
460 );
461
462 $this->start_controls_tabs( 'button_icon_color' );
463
464 $this->start_controls_tab(
465 'icon_color_normal',
466 array(
467 'label' => __( 'Normal' , 'auxin-elements' )
468 )
469 );
470
471 $this->add_control(
472 'icon_color',
473 array(
474 'label' => __( 'Color', 'auxin-elements' ),
475 'type' => Controls_Manager::COLOR,
476 'selectors' => array(
477 '{{WRAPPER}} .aux-icon' => 'color: {{VALUE}}; fill: {{VALUE}};',
478 )
479 )
480 );
481
482 $this->end_controls_tab();
483
484 $this->start_controls_tab(
485 'icon_color_hover',
486 array(
487 'label' => __( 'Hover' , 'auxin-elements' )
488 )
489 );
490
491 $this->add_control(
492 'hover_icon_color',
493 array(
494 'label' => __( 'Color', 'auxin-elements' ),
495 'type' => Controls_Manager::COLOR,
496 'selectors' => array(
497 '{{WRAPPER}} .aux-button:hover .aux-icon' => 'color: {{VALUE}};fill: {{VALUE}};',
498 )
499 )
500 );
501
502 $this->end_controls_tab();
503
504 $this->end_controls_tabs();
505
506 $this->add_responsive_control(
507 'icon_padding',
508 array(
509 'label' => __( 'Padding', 'auxin-elements' ),
510 'type' => Controls_Manager::DIMENSIONS,
511 'size_units' => array( 'px', '%' ),
512 'selectors' => array(
513 '{{WRAPPER}} .aux-icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
514 )
515 )
516 );
517
518 $this->end_controls_section();
519
520 /*-----------------------------------------------------------------------------------*/
521 /* text_section
522 /*-----------------------------------------------------------------------------------*/
523
524 $this->start_controls_section(
525 'text_section',
526 array(
527 'label' => __('Text', 'auxin-elements' ),
528 'tab' => Controls_Manager::TAB_STYLE,
529 )
530 );
531
532 $this->start_controls_tabs( 'button_text' );
533
534 $this->start_controls_tab(
535 'button_text_normal',
536 array(
537 'label' => __( 'Normal' , 'auxin-elements' )
538 )
539 );
540
541 $this->add_control(
542 'text_color',
543 array(
544 'label' => __( 'Color', 'auxin-elements' ),
545 'type' => Controls_Manager::COLOR,
546 'selectors' => array(
547 '{{WRAPPER}} .aux-text' => 'color: {{VALUE}};',
548 )
549 )
550 );
551
552 $this->add_group_control(
553 Group_Control_Text_Shadow::get_type(),
554 array(
555 'name' => 'text_shadow',
556 'label' => __( 'Text Shadow', 'auxin-elements' ),
557 'selector' => '{{WRAPPER}} .aux-button',
558 )
559 );
560
561 $this->add_group_control(
562 Group_Control_Typography::get_type(),
563 array(
564 'name' => '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->start_controls_tab(
575 'button_text_hover',
576 array(
577 'label' => __( 'Hover' , 'auxin-elements' )
578 )
579 );
580
581 $this->add_control(
582 'hover_text_color',
583 array(
584 'label' => __( 'Color', 'auxin-elements' ),
585 'type' => Controls_Manager::COLOR,
586 'selectors' => array(
587 '{{WRAPPER}} .aux-button:hover .aux-text' => 'color: {{VALUE}};',
588 )
589 )
590 );
591
592 $this->add_group_control(
593 Group_Control_Text_Shadow::get_type(),
594 array(
595 'name' => 'hover_text_shadow',
596 'label' => __( 'Text Shadow', 'auxin-elements' ),
597 'selector' => '{{WRAPPER}} .aux-button:hover',
598 )
599 );
600
601 $this->add_group_control(
602 Group_Control_Typography::get_type(),
603 array(
604 'name' => 'hover_text_typography',
605 'global' => [
606 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
607 ],
608 'selector' => '{{WRAPPER}} .aux-text'
609 )
610 );
611
612 $this->end_controls_tab();
613
614 $this->end_controls_tabs();
615
616 $this->end_controls_section();
617 }
618
619 /**
620 * Render image box widget output on the frontend.
621 *
622 * Written in PHP and used to generate the final HTML.
623 *
624 * @since 1.0.0
625 * @access protected
626 */
627 protected function render() {
628
629 $settings = $this->get_settings_for_display();
630
631 $icon_value = ! empty( $settings['aux_button_icon']['value'] ) ? $settings['aux_button_icon'] : ( ! empty( $settings['icon'] ) ? $settings['icon'] : '' ) ;
632
633 $btn_target = $settings['link']['is_external'] ? '_blank' : '_self';
634
635 $args = array(
636 'label' => $settings['label'],
637 'size' => $settings['size'],
638 'border' => $settings['border'],
639 'style' => $settings['style'],
640 'uppercase' => $settings['uppercase'],
641 'icon' => $icon_value,
642 'icon_align' => $settings['icon_align'],
643 'color_name' => $settings['color_name'],
644 'link' => $settings['link']['url'],
645 'nofollow' => $settings['link']['nofollow'],
646 'target' => $btn_target,
647 'open_video_in_lightbox' => $settings['open_video_in_lightbox'],
648 );
649
650 // get the shortcode base blog page
651 echo auxin_widget_button_callback( $args );
652
653 }
654
655 }
656