PluginProbe
Elementor Website Builder – more than just a page builder / 3.16.2
Elementor Website Builder – more than just a page builder v3.16.2
4.3.0-beta3 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 All 452 releases
elementor / core / kits / documents / tabs / theme-style-buttons.php

theme-style-buttons.php in Elementor Website Builder – more than just a page builder 3.16.2, at core/kits/documents/tabs/theme-style-buttons.php

256 lines 5.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Core\Kits\Documents\Tabs;
4
5 use Elementor\Controls_Manager;
6 use Elementor\Group_Control_Background;
7 use Elementor\Group_Control_Border;
8 use Elementor\Group_Control_Box_Shadow;
9 use Elementor\Group_Control_Text_Shadow;
10 use Elementor\Group_Control_Typography;
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit; // Exit if accessed directly
14 }
15
16 class Theme_Style_Buttons extends Tab_Base {
17
18 public function get_id() {
19 return 'theme-style-buttons';
20 }
21
22 public function get_title() {
23 return esc_html__( 'Buttons', 'elementor' );
24 }
25
26 public function get_group() {
27 return 'theme-style';
28 }
29
30 public function get_icon() {
31 return 'eicon-button';
32 }
33
34 public function get_help_url() {
35 return 'https://go.elementor.com/global-theme-style-buttons/';
36 }
37
38 protected function register_tab_controls() {
39 $button_selectors = [
40 '{{WRAPPER}} button',
41 '{{WRAPPER}} input[type="button"]',
42 '{{WRAPPER}} input[type="submit"]',
43 '{{WRAPPER}} .elementor-button',
44 ];
45
46 $button_hover_selectors = [
47 '{{WRAPPER}} button:hover',
48 '{{WRAPPER}} button:focus',
49 '{{WRAPPER}} input[type="button"]:hover',
50 '{{WRAPPER}} input[type="button"]:focus',
51 '{{WRAPPER}} input[type="submit"]:hover',
52 '{{WRAPPER}} input[type="submit"]:focus',
53 '{{WRAPPER}} .elementor-button:hover',
54 '{{WRAPPER}} .elementor-button:focus',
55 ];
56
57 $button_selector = implode( ',', $button_selectors );
58 $button_hover_selector = implode( ',', $button_hover_selectors );
59
60 $this->start_controls_section(
61 'section_buttons',
62 [
63 'label' => esc_html__( 'Buttons', 'elementor' ),
64 'tab' => $this->get_id(),
65 ]
66 );
67
68 $this->add_default_globals_notice();
69
70 $this->add_group_control(
71 Group_Control_Typography::get_type(),
72 [
73 'name' => 'button_typography',
74 'selector' => $button_selector,
75 ]
76 );
77
78 $this->add_group_control(
79 Group_Control_Text_Shadow::get_type(),
80 [
81 'name' => 'button_text_shadow',
82 'selector' => $button_selector,
83 ]
84 );
85
86 $this->start_controls_tabs( 'tabs_button_style' );
87
88 $this->start_controls_tab(
89 'tab_button_normal',
90 [
91 'label' => esc_html__( 'Normal', 'elementor' ),
92 ]
93 );
94
95 $this->add_control(
96 'button_text_color',
97 [
98 'label' => esc_html__( 'Text Color', 'elementor' ),
99 'type' => Controls_Manager::COLOR,
100 'dynamic' => [],
101 'selectors' => [
102 $button_selector => 'color: {{VALUE}};',
103 ],
104 ]
105 );
106
107 $this->add_group_control(
108 Group_Control_Background::get_type(),
109 [
110 'name' => 'button_background',
111 'types' => [ 'classic', 'gradient' ],
112 'exclude' => [ 'image' ],
113 'selector' => $button_selector,
114 'fields_options' => [
115 'background' => [
116 'default' => 'classic',
117 ],
118 'color' => [
119 'dynamic' => [],
120 ],
121 'color_b' => [
122 'dynamic' => [],
123 ],
124 ],
125 ]
126 );
127
128 $this->add_group_control(
129 Group_Control_Box_Shadow::get_type(),
130 [
131 'name' => 'button_box_shadow',
132 'selector' => $button_selector,
133 ]
134 );
135
136 $this->add_group_control(
137 Group_Control_Border::get_type(),
138 [
139 'name' => 'button_border',
140 'selector' => $button_selector,
141 'fields_options' => [
142 'color' => [
143 'dynamic' => [],
144 ],
145 ],
146 ]
147 );
148
149 $this->add_control(
150 'button_border_radius',
151 [
152 'label' => esc_html__( 'Border Radius', 'elementor' ),
153 'type' => Controls_Manager::DIMENSIONS,
154 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
155 'selectors' => [
156 $button_selector => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
157 ],
158 ]
159 );
160
161 $this->end_controls_tab();
162
163 $this->start_controls_tab(
164 'tab_button_hover',
165 [
166 'label' => esc_html__( 'Hover', 'elementor' ),
167 ]
168 );
169
170 $this->add_control(
171 'button_hover_text_color',
172 [
173 'label' => esc_html__( 'Text Color', 'elementor' ),
174 'type' => Controls_Manager::COLOR,
175 'dynamic' => [],
176 'selectors' => [
177 $button_hover_selector => 'color: {{VALUE}};',
178 ],
179 ]
180 );
181
182 $this->add_group_control(
183 Group_Control_Background::get_type(),
184 [
185 'name' => 'button_hover_background',
186 'types' => [ 'classic', 'gradient' ],
187 'exclude' => [ 'image' ],
188 'selector' => $button_hover_selector,
189 'fields_options' => [
190 'background' => [
191 'default' => 'classic',
192 ],
193 'color' => [
194 'dynamic' => [],
195 ],
196 'color_b' => [
197 'dynamic' => [],
198 ],
199 ],
200 ]
201 );
202
203 $this->add_group_control(
204 Group_Control_Box_Shadow::get_type(),
205 [
206 'name' => 'button_hover_box_shadow',
207 'selector' => $button_hover_selector,
208 ]
209 );
210
211 $this->add_group_control(
212 Group_Control_Border::get_type(),
213 [
214 'name' => 'button_hover_border',
215 'selector' => $button_hover_selector,
216 'fields_options' => [
217 'color' => [
218 'dynamic' => [],
219 ],
220 ],
221 ]
222 );
223
224 $this->add_control(
225 'button_hover_border_radius',
226 [
227 'label' => esc_html__( 'Border Radius', 'elementor' ),
228 'type' => Controls_Manager::DIMENSIONS,
229 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
230 'selectors' => [
231 $button_hover_selector => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
232 ],
233 ]
234 );
235
236 $this->end_controls_tab();
237
238 $this->end_controls_tabs();
239
240 $this->add_responsive_control(
241 'button_padding',
242 [
243 'label' => esc_html__( 'Padding', 'elementor' ),
244 'type' => Controls_Manager::DIMENSIONS,
245 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
246 'selectors' => [
247 $button_selector => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
248 ],
249 'separator' => 'before',
250 ]
251 );
252
253 $this->end_controls_section();
254 }
255 }
256