PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.5.0
Shortcodes and extra features for Phlox theme v2.5.0
2.17.22 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 years ago accordion.php 6 years ago audio.php 6 years ago before-after.php 6 years ago button.php 6 years ago carousel-navigation.php 6 years ago contact-box.php 6 years ago contact-form.php 6 years ago custom-list.php 6 years ago divider.php 6 years ago gallery.php 6 years ago gmap.php 6 years ago heading-modern.php 6 years ago icon.php 6 years ago image.php 6 years ago mailchimp.php 6 years ago quote.php 6 years ago recent-comments.php 6 years ago recent-posts-grid-carousel.php 6 years ago recent-posts-land-style.php 6 years ago recent-posts-masonry.php 6 years ago recent-posts-tiles-carousel.php 6 years ago recent-posts-tiles.php 6 years ago recent-posts-timeline.php 6 years ago recent-products.php 6 years ago search.php 6 years ago staff.php 6 years ago svg.php 6 years ago tabs.php 6 years ago testimonial.php 6 years ago text.php 6 years ago touch-slider.php 6 years ago video.php 6 years ago
button.php
597 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\Scheme_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
128 $this->end_controls_section();
129
130 /*-----------------------------------------------------------------------------------*/
131 /* general_section
132 /*-----------------------------------------------------------------------------------*/
133
134 $this->start_controls_section(
135 'general_section',
136 array(
137 'label' => __('Wrapper', 'auxin-elements' ),
138 'tab' => Controls_Manager::TAB_STYLE,
139 )
140 );
141
142 $this->add_control(
143 'size',
144 array(
145 'label' => __('Button size', 'auxin-elements'),
146 'type' => Controls_Manager::SELECT,
147 'default' => 'medium',
148 'options' => array(
149 'exlarge' => __('Exlarge', 'auxin-elements' ),
150 'large' => __('Large' , 'auxin-elements' ),
151 'medium' => __('Medium' , 'auxin-elements' ),
152 'small' => __('Small' , 'auxin-elements' ),
153 'tiny' => __('Tiny' , 'auxin-elements' )
154 )
155 )
156 );
157
158 $this->add_control(
159 'uppercase',
160 array(
161 'label' => __('Uppercase label','auxin-elements' ),
162 'type' => Controls_Manager::SWITCHER,
163 'label_on' => __( 'On', 'auxin-elements' ),
164 'label_off' => __( 'Off', 'auxin-elements' ),
165 'return_value' => 'yes',
166 'default' => 'yes'
167 )
168 );
169
170 $this->add_control(
171 'border',
172 array(
173 'label' => __('Button shape','auxin-elements' ),
174 'type' => 'aux-visual-select',
175 'options' => array(
176 'none' => array(
177 'label' => __('Box', 'auxin-elements' ),
178 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg'
179 ),
180 'round' => array(
181 'label' => __('Round', 'auxin-elements' ),
182 'image' => AUXIN_URL . 'images/visual-select/button-curved.svg'
183 ),
184 'curve' => array(
185 'label' => __('Curve', 'auxin-elements' ),
186 'image' => AUXIN_URL . 'images/visual-select/button-rounded.svg'
187 )
188 ),
189 'default' => 'none'
190 )
191 );
192
193 $this->add_control(
194 'style',
195 array(
196 'label' => __('Button style','auxin-elements' ),
197 'type' => 'aux-visual-select',
198 'options' => array(
199 'none' => array(
200 'label' => __('Normal', 'auxin-elements' ),
201 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg'
202 ),
203 '3d' => array(
204 'label' => __('3D', 'auxin-elements' ),
205 'image' => AUXIN_URL . 'images/visual-select/button-3d.svg'
206 ),
207 'outline' => array(
208 'label' => __('Outline', 'auxin-elements' ),
209 'image' => AUXIN_URL . 'images/visual-select/button-outline.svg'
210 )
211 ),
212 'default' => 'none'
213 )
214 );
215
216 $this->add_responsive_control(
217 'align',
218 array(
219 'label' => __('Align','auxin-elements'),
220 'type' => Controls_Manager::CHOOSE,
221 'options' => array(
222 'left' => array(
223 'title' => __( 'Left', 'auxin-elements' ),
224 'icon' => 'fa fa-align-left',
225 ),
226 'center' => array(
227 'title' => __( 'Center', 'auxin-elements' ),
228 'icon' => 'fa fa-align-center',
229 ),
230 'right' => array(
231 'title' => __( 'Right', 'auxin-elements' ),
232 'icon' => 'fa fa-align-right',
233 ),
234 ),
235 'default' => 'center',
236 'toggle' => true,
237 'selectors' => array(
238 '{{WRAPPER}}' => 'text-align: {{VALUE}}',
239 )
240 )
241 );
242
243 $this->add_responsive_control(
244 'button_padding',
245 array(
246 'label' => __( 'Padding', 'auxin-elements' ),
247 'type' => Controls_Manager::DIMENSIONS,
248 'size_units' => array( 'px', '%' ),
249 'selectors' => array(
250 '{{WRAPPER}} .aux-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
251 )
252 )
253 );
254
255 $this->end_controls_section();
256
257 /*-----------------------------------------------------------------------------------*/
258 /* sking_section
259 /*-----------------------------------------------------------------------------------*/
260
261 $this->start_controls_section(
262 'sking_section',
263 array(
264 'label' => __('Skin', 'auxin-elements' ),
265 'tab' => Controls_Manager::TAB_STYLE,
266 )
267 );
268
269 $this->add_control(
270 'color_name',
271 array(
272 'label' => __('Skin', 'auxin-elements'),
273 'type' => 'aux-visual-select',
274 'default' => 'carmine-pink',
275 'options' => auxin_get_famous_colors_list()
276 )
277 );
278
279 $this->start_controls_tabs( 'button_background' );
280
281 $this->start_controls_tab(
282 'button_bg_normal',
283 array(
284 'label' => __( 'Normal' , 'auxin-elements' )
285 )
286 );
287
288 $this->add_group_control(
289 Group_Control_Background::get_type(),
290 array(
291 'name' => 'background',
292 'label' => __( 'Background', 'auxin-elements' ),
293 'types' => array( 'classic', 'gradient' ),
294 'selector' => '{{WRAPPER}} .aux-button',
295 )
296 );
297
298 $this->add_group_control(
299 Group_Control_Box_Shadow::get_type(),
300 array(
301 'name' => 'box_shadow',
302 'selector' => '{{WRAPPER}} .aux-button'
303 )
304 );
305
306 $this->end_controls_tab();
307
308 $this->start_controls_tab(
309 'button_bg_hover',
310 array(
311 'label' => __( 'Hover' , 'auxin-elements' )
312 )
313 );
314
315 $this->add_group_control(
316 Group_Control_Background::get_type(),
317 array(
318 'name' => 'hover_background',
319 'label' => __( 'Background', 'auxin-elements' ),
320 'types' => array( 'classic', 'gradient' ),
321 'selector' => '{{WRAPPER}} .aux-button .aux-overlay::after',
322 )
323 );
324
325 $this->add_group_control(
326 Group_Control_Box_Shadow::get_type(),
327 array(
328 'name' => 'hover_box_shadow',
329 'selector' => '{{WRAPPER}} .aux-button:hover'
330 )
331 );
332
333 $this->end_controls_tab();
334
335 $this->end_controls_tabs();
336
337 $this->end_controls_section();
338
339 /*-----------------------------------------------------------------------------------*/
340 /* icon_section
341 /*-----------------------------------------------------------------------------------*/
342
343 $this->start_controls_section(
344 'icon_section',
345 array(
346 'label' => __('Icon', 'auxin-elements' ),
347 'tab' => Controls_Manager::TAB_STYLE,
348 )
349 );
350
351 $this->add_control(
352 'icon',
353 array(
354 'label' => __('Icon for button','auxin-elements' ),
355 'type' => 'aux-icon'
356 )
357 );
358
359 $this->add_control(
360 'icon_align',
361 array(
362 'label' => __('Icon alignment', 'auxin-elements'),
363 'type' => Controls_Manager::SELECT,
364 'default' => 'default',
365 'options' => array(
366 'default' => __('Default' , 'auxin-elements' ),
367 'left' => __('Left' , 'auxin-elements' ),
368 'right' => __('Right' , 'auxin-elements' ),
369 'over' => __('Over' , 'auxin-elements' ),
370 'left-animate' => __('Animate from Left' , 'auxin-elements' ),
371 'right-animate' => __('Animate from Right' , 'auxin-elements' )
372 )
373 )
374 );
375
376 $this->add_responsive_control(
377 'btn_icon_size',
378 array(
379 'label' => __( 'Icon Size', 'auxin-elements' ),
380 'type' => Controls_Manager::SLIDER,
381 'size_units' => array( 'px', '%' ),
382 'range' => array(
383 'px' => array(
384 'min' => 10,
385 'max' => 512,
386 'step' => 2,
387 ),
388 '%' => array(
389 'min' => 0,
390 'max' => 100,
391 ),
392 ),
393 'selectors' => array(
394 '{{WRAPPER}} .aux-icon' => 'font-size: {{SIZE}}{{UNIT}};',
395 )
396 )
397 );
398
399 $this->add_responsive_control(
400 'icon_margin',
401 array(
402 'label' => __( 'Icon Margin', 'auxin-elements' ),
403 'type' => Controls_Manager::DIMENSIONS,
404 'size_units' => array( 'px', '%' ),
405 'selectors' => array(
406 '{{WRAPPER}} .aux-icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
407 )
408 )
409 );
410
411 $this->start_controls_tabs( 'button_icon_color' );
412
413 $this->start_controls_tab(
414 'icon_color_normal',
415 array(
416 'label' => __( 'Normal' , 'auxin-elements' )
417 )
418 );
419
420 $this->add_control(
421 'icon_color',
422 array(
423 'label' => __( 'Color', 'auxin-elements' ),
424 'type' => Controls_Manager::COLOR,
425 'selectors' => array(
426 '{{WRAPPER}} .aux-icon' => 'color: {{VALUE}};',
427 )
428 )
429 );
430
431 $this->end_controls_tab();
432
433 $this->start_controls_tab(
434 'icon_color_hover',
435 array(
436 'label' => __( 'Hover' , 'auxin-elements' )
437 )
438 );
439
440 $this->add_control(
441 'hover_icon_color',
442 array(
443 'label' => __( 'Color', 'auxin-elements' ),
444 'type' => Controls_Manager::COLOR,
445 'selectors' => array(
446 '{{WRAPPER}} .aux-button:hover .aux-icon' => 'color: {{VALUE}};',
447 )
448 )
449 );
450
451 $this->end_controls_tab();
452
453 $this->end_controls_tabs();
454
455 $this->add_responsive_control(
456 'icon_padding',
457 array(
458 'label' => __( 'Padding', 'auxin-elements' ),
459 'type' => Controls_Manager::DIMENSIONS,
460 'size_units' => array( 'px', '%' ),
461 'selectors' => array(
462 '{{WRAPPER}} .aux-icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
463 )
464 )
465 );
466
467 $this->end_controls_section();
468
469 /*-----------------------------------------------------------------------------------*/
470 /* text_section
471 /*-----------------------------------------------------------------------------------*/
472
473 $this->start_controls_section(
474 'text_section',
475 array(
476 'label' => __('Text', 'auxin-elements' ),
477 'tab' => Controls_Manager::TAB_STYLE,
478 )
479 );
480
481 $this->start_controls_tabs( 'button_text' );
482
483 $this->start_controls_tab(
484 'button_text_normal',
485 array(
486 'label' => __( 'Normal' , 'auxin-elements' )
487 )
488 );
489
490 $this->add_control(
491 'text_color',
492 array(
493 'label' => __( 'Color', 'auxin-elements' ),
494 'type' => Controls_Manager::COLOR,
495 'selectors' => array(
496 '{{WRAPPER}} .aux-text' => 'color: {{VALUE}};',
497 )
498 )
499 );
500
501 $this->add_group_control(
502 Group_Control_Text_Shadow::get_type(),
503 array(
504 'name' => 'text_shadow',
505 'label' => __( 'Text Shadow', 'auxin-elements' ),
506 'selector' => '{{WRAPPER}} .aux-button',
507 )
508 );
509
510 $this->add_group_control(
511 Group_Control_Typography::get_type(),
512 array(
513 'name' => 'text_typography',
514 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
515 'selector' => '{{WRAPPER}} .aux-text'
516 )
517 );
518
519 $this->end_controls_tab();
520
521 $this->start_controls_tab(
522 'button_text_hover',
523 array(
524 'label' => __( 'Hover' , 'auxin-elements' )
525 )
526 );
527
528 $this->add_control(
529 'hover_text_color',
530 array(
531 'label' => __( 'Color', 'auxin-elements' ),
532 'type' => Controls_Manager::COLOR,
533 'selectors' => array(
534 '{{WRAPPER}} .aux-button:hover .aux-text' => 'color: {{VALUE}};',
535 )
536 )
537 );
538
539 $this->add_group_control(
540 Group_Control_Text_Shadow::get_type(),
541 array(
542 'name' => 'hover_text_shadow',
543 'label' => __( 'Text Shadow', 'auxin-elements' ),
544 'selector' => '{{WRAPPER}} .aux-button:hover',
545 )
546 );
547
548 $this->add_group_control(
549 Group_Control_Typography::get_type(),
550 array(
551 'name' => 'hover_text_typography',
552 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
553 'selector' => '{{WRAPPER}} .aux-text'
554 )
555 );
556
557 $this->end_controls_tab();
558
559 $this->end_controls_tabs();
560
561 $this->end_controls_section();
562 }
563
564 /**
565 * Render image box widget output on the frontend.
566 *
567 * Written in PHP and used to generate the final HTML.
568 *
569 * @since 1.0.0
570 * @access protected
571 */
572 protected function render() {
573
574 $settings = $this->get_settings_for_display();
575
576 $btn_target = $settings['link']['is_external'] ? '_blank' : '_self';
577
578 $args = array(
579 'label' => $settings['label'],
580 'size' => $settings['size'],
581 'border' => $settings['border'],
582 'style' => $settings['style'],
583 'uppercase' => $settings['uppercase'],
584 'icon' => $settings['icon'],
585 'icon_align' => $settings['icon_align'],
586 'color_name' => $settings['color_name'],
587 'link' => $settings['link']['url'],
588 'nofollow' => $settings['link']['nofollow'],
589 'target' => $btn_target
590 );
591
592 // get the shortcode base blog page
593 echo auxin_widget_button_callback( $args );
594
595 }
596
597 }