PluginProbe
Elementor Website Builder – more than just a page builder / 3.29.1
Elementor Website Builder – more than just a page builder v3.29.1
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / includes / widgets / button.php

button.php in Elementor Website Builder – more than just a page builder 3.29.1, at includes/widgets/button.php

136 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor;
3
4 use Elementor\Includes\Widgets\Traits\Button_Trait;
5 use Elementor\Modules\Promotions\Controls\Promotion_Control;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // Exit if accessed directly.
9 }
10
11 /**
12 * Elementor button widget.
13 *
14 * Elementor widget that displays a button with the ability to control every
15 * aspect of the button design.
16 *
17 * @since 1.0.0
18 */
19 class Widget_Button extends Widget_Base {
20
21 use Button_Trait;
22
23 /**
24 * Get widget name.
25 *
26 * Retrieve button widget name.
27 *
28 * @since 1.0.0
29 * @access public
30 *
31 * @return string Widget name.
32 */
33 public function get_name() {
34 return 'button';
35 }
36
37 /**
38 * Get widget title.
39 *
40 * Retrieve button widget title.
41 *
42 * @since 1.0.0
43 * @access public
44 *
45 * @return string Widget title.
46 */
47 public function get_title() {
48 return esc_html__( 'Button', 'elementor' );
49 }
50
51 /**
52 * Get widget icon.
53 *
54 * Retrieve button widget icon.
55 *
56 * @since 1.0.0
57 * @access public
58 *
59 * @return string Widget icon.
60 */
61 public function get_icon() {
62 return 'eicon-button';
63 }
64
65 /**
66 * Get widget categories.
67 *
68 * Retrieve the list of categories the button widget belongs to.
69 *
70 * Used to determine where to display the widget in the editor.
71 *
72 * @since 2.0.0
73 * @access public
74 *
75 * @return array Widget categories.
76 */
77 public function get_categories() {
78 return [ 'basic' ];
79 }
80
81 protected function is_dynamic_content(): bool {
82 return false;
83 }
84
85 public function has_widget_inner_wrapper(): bool {
86 return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
87 }
88
89 protected function register_controls() {
90 $this->start_controls_section(
91 'section_button',
92 [
93 'label' => esc_html__( 'Button', 'elementor' ),
94 ]
95 );
96
97 $this->register_button_content_controls();
98
99 if ( ! Utils::has_pro() ) {
100 $this->add_control(
101 Utils::CTA . '_promotion',
102 [
103 'label' => esc_html__( 'Call to Action widget', 'elementor' ),
104 'type' => Promotion_Control::TYPE,
105 ]
106 );
107 }
108
109 $this->end_controls_section();
110
111 $this->start_controls_section(
112 'section_style',
113 [
114 'label' => esc_html__( 'Button', 'elementor' ),
115 'tab' => Controls_Manager::TAB_STYLE,
116 ]
117 );
118
119 $this->register_button_style_controls();
120
121 $this->end_controls_section();
122 }
123
124 /**
125 * Render button widget output on the frontend.
126 *
127 * Written in PHP and used to generate the final HTML.
128 *
129 * @since 1.0.0
130 * @access protected
131 */
132 protected function render() {
133 $this->render_button();
134 }
135 }
136