PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.5
Elementor Website Builder – more than just a page builder v4.0.5
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 / core / kits / documents / tabs / theme-style-form-fields.php

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

243 lines 5.3 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_Border;
7 use Elementor\Group_Control_Box_Shadow;
8 use Elementor\Group_Control_Typography;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit; // Exit if accessed directly.
12 }
13
14 class Theme_Style_Form_Fields extends Tab_Base {
15
16 public function get_id() {
17 return 'theme-style-form-fields';
18 }
19
20 public function get_title() {
21 return esc_html__( 'Form Fields', 'elementor' );
22 }
23
24 public function get_group() {
25 return 'theme-style';
26 }
27
28 public function get_icon() {
29 return 'eicon-form-horizontal';
30 }
31
32 public function get_help_url() {
33 return 'https://go.elementor.com/global-theme-style-form-fields/';
34 }
35
36 protected function register_tab_controls() {
37 $label_selectors = [
38 '{{WRAPPER}} label',
39 ];
40
41 $input_selectors = [
42 '{{WRAPPER}} input:not([type="button"]):not([type="submit"])',
43 '{{WRAPPER}} textarea',
44 '{{WRAPPER}} .elementor-field-textual',
45 ];
46
47 $input_focus_selectors = [
48 '{{WRAPPER}} input:focus:not([type="button"]):not([type="submit"])',
49 '{{WRAPPER}} textarea:focus',
50 '{{WRAPPER}} .elementor-field-textual:focus',
51 ];
52
53 $label_selector = implode( ',', $label_selectors );
54 $input_selector = implode( ',', $input_selectors );
55 $input_focus_selector = implode( ',', $input_focus_selectors );
56
57 $this->start_controls_section(
58 'section_form_fields',
59 [
60 'label' => esc_html__( 'Form Fields', 'elementor' ),
61 'tab' => $this->get_id(),
62 ]
63 );
64
65 $this->add_default_globals_notice();
66
67 $this->add_control(
68 'form_label_heading',
69 [
70 'type' => Controls_Manager::HEADING,
71 'label' => esc_html__( 'Label', 'elementor' ),
72 ]
73 );
74
75 $this->add_control(
76 'form_label_color',
77 [
78 'label' => esc_html__( 'Color', 'elementor' ),
79 'type' => Controls_Manager::COLOR,
80 'dynamic' => [],
81 'selectors' => [
82 $label_selector => 'color: {{VALUE}};',
83 ],
84 ]
85 );
86
87 $this->add_group_control(
88 Group_Control_Typography::get_type(),
89 [
90 'name' => 'form_label_typography',
91 'selector' => $label_selector,
92 ]
93 );
94
95 $this->add_control(
96 'form_field_heading',
97 [
98 'type' => Controls_Manager::HEADING,
99 'label' => esc_html__( 'Field', 'elementor' ),
100 'separator' => 'before',
101 ]
102 );
103
104 $this->add_group_control(
105 Group_Control_Typography::get_type(),
106 [
107 'name' => 'form_field_typography',
108 'selector' => $input_selector,
109 ]
110 );
111
112 $this->start_controls_tabs( 'tabs_form_field_style' );
113
114 $this->start_controls_tab(
115 'tab_form_field_normal',
116 [
117 'label' => esc_html__( 'Normal', 'elementor' ),
118 ]
119 );
120
121 $this->add_form_field_state_tab_controls( 'form_field', $input_selector );
122
123 $this->end_controls_tab();
124
125 $this->start_controls_tab(
126 'tab_form_field_focus',
127 [
128 'label' => esc_html__( 'Focus', 'elementor' ),
129 ]
130 );
131
132 $this->add_form_field_state_tab_controls( 'form_field_focus', $input_focus_selector );
133
134 $this->add_control(
135 'form_field_focus_transition_duration',
136 [
137 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (ms)',
138 'type' => Controls_Manager::SLIDER,
139 'selectors' => [
140 $input_selector => 'transition: {{SIZE}}ms',
141 ],
142 'range' => [
143 'px' => [
144 'min' => 0,
145 'max' => 3000,
146 'step' => 100,
147 ],
148 ],
149 ]
150 );
151
152 $this->end_controls_tab();
153
154 $this->end_controls_tabs();
155
156 $this->add_responsive_control(
157 'form_field_padding',
158 [
159 'label' => esc_html__( 'Padding', 'elementor' ),
160 'type' => Controls_Manager::DIMENSIONS,
161 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
162 'selectors' => [
163 $input_selector => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
164 ],
165 'separator' => 'before',
166 ]
167 );
168
169 $this->end_controls_section();
170 }
171
172 private function add_form_field_state_tab_controls( $prefix, $selector ) {
173 $this->add_control(
174 $prefix . '_text_color',
175 [
176 'label' => esc_html__( 'Text Color', 'elementor' ),
177 'type' => Controls_Manager::COLOR,
178 'dynamic' => [],
179 'selectors' => [
180 $selector => 'color: {{VALUE}};',
181 ],
182 ]
183 );
184
185 $this->add_control(
186 $prefix . '_accent_color',
187 [
188 'label' => esc_html__( 'Accent Color', 'elementor' ),
189 'type' => Controls_Manager::COLOR,
190 'dynamic' => [],
191 'selectors' => [
192 $selector => 'accent-color: {{VALUE}};',
193 ],
194 ]
195 );
196
197 $this->add_control(
198 $prefix . '_background_color',
199 [
200 'label' => esc_html__( 'Background Color', 'elementor' ),
201 'type' => Controls_Manager::COLOR,
202 'dynamic' => [],
203 'selectors' => [
204 $selector => 'background-color: {{VALUE}};',
205 ],
206 ]
207 );
208
209 $this->add_group_control(
210 Group_Control_Box_Shadow::get_type(),
211 [
212 'name' => $prefix . '_box_shadow',
213 'selector' => $selector,
214 ]
215 );
216
217 $this->add_group_control(
218 Group_Control_Border::get_type(),
219 [
220 'name' => $prefix . '_border',
221 'selector' => $selector,
222 'fields_options' => [
223 'color' => [
224 'dynamic' => [],
225 ],
226 ],
227 ]
228 );
229
230 $this->add_control(
231 $prefix . '_border_radius',
232 [
233 'label' => esc_html__( 'Border Radius', 'elementor' ),
234 'type' => Controls_Manager::DIMENSIONS,
235 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
236 'selectors' => [
237 $selector => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
238 ],
239 ]
240 );
241 }
242 }
243