PluginProbe
Elementor Website Builder – more than just a page builder / 3.6.2
Elementor Website Builder – more than just a page builder v3.6.2
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 3.6.2, at core/kits/documents/tabs/theme-style-form-fields.php

232 lines 5.1 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 'label' => esc_html__( 'Typography', 'elementor' ),
91 'name' => 'form_label_typography',
92 'selector' => $label_selector,
93 ]
94 );
95
96 $this->add_control(
97 'form_field_heading',
98 [
99 'type' => Controls_Manager::HEADING,
100 'label' => esc_html__( 'Field', 'elementor' ),
101 'separator' => 'before',
102 ]
103 );
104
105 $this->add_group_control(
106 Group_Control_Typography::get_type(),
107 [
108 'label' => esc_html__( 'Typography', 'elementor' ),
109 'name' => 'form_field_typography',
110 'selector' => $input_selector,
111 ]
112 );
113
114 $this->start_controls_tabs( 'tabs_form_field_style' );
115
116 $this->start_controls_tab(
117 'tab_form_field_normal',
118 [
119 'label' => esc_html__( 'Normal', 'elementor' ),
120 ]
121 );
122
123 $this->add_form_field_state_tab_controls( 'form_field', $input_selector );
124
125 $this->end_controls_tab();
126
127 $this->start_controls_tab(
128 'tab_form_field_focus',
129 [
130 'label' => esc_html__( 'Focus', 'elementor' ),
131 ]
132 );
133
134 $this->add_form_field_state_tab_controls( 'form_field_focus', $input_focus_selector );
135
136 $this->add_control(
137 'form_field_focus_transition_duration',
138 [
139 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (ms)',
140 'type' => Controls_Manager::SLIDER,
141 'selectors' => [
142 $input_selector => 'transition: {{SIZE}}ms',
143 ],
144 'range' => [
145 'px' => [
146 'min' => 0,
147 'max' => 3000,
148 ],
149 ],
150 ]
151 );
152
153 $this->end_controls_tab();
154
155 $this->end_controls_tabs();
156
157 $this->add_responsive_control(
158 'form_field_padding',
159 [
160 'label' => esc_html__( 'Padding', 'elementor' ),
161 'type' => Controls_Manager::DIMENSIONS,
162 'size_units' => [ 'px', 'em', '%' ],
163 'selectors' => [
164 $input_selector => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
165 ],
166 'separator' => 'before',
167 ]
168 );
169
170 $this->end_controls_section();
171 }
172
173 private function add_form_field_state_tab_controls( $prefix, $selector ) {
174 $this->add_control(
175 $prefix . '_text_color',
176 [
177 'label' => esc_html__( 'Text Color', 'elementor' ),
178 'type' => Controls_Manager::COLOR,
179 'dynamic' => [],
180 'selectors' => [
181 $selector => 'color: {{VALUE}};',
182 ],
183 ]
184 );
185
186 $this->add_control(
187 $prefix . '_background_color',
188 [
189 'label' => esc_html__( 'Background Color', 'elementor' ),
190 'type' => Controls_Manager::COLOR,
191 'dynamic' => [],
192 'selectors' => [
193 $selector => 'background-color: {{VALUE}};',
194 ],
195 ]
196 );
197
198 $this->add_group_control(
199 Group_Control_Box_Shadow::get_type(),
200 [
201 'name' => $prefix . '_box_shadow',
202 'selector' => $selector,
203 ]
204 );
205
206 $this->add_group_control(
207 Group_Control_Border::get_type(),
208 [
209 'name' => $prefix . '_border',
210 'selector' => $selector,
211 'fields_options' => [
212 'color' => [
213 'dynamic' => [],
214 ],
215 ],
216 ]
217 );
218
219 $this->add_control(
220 $prefix . '_border_radius',
221 [
222 'label' => esc_html__( 'Border Radius', 'elementor' ),
223 'type' => Controls_Manager::DIMENSIONS,
224 'size_units' => [ 'px', '%' ],
225 'selectors' => [
226 $selector => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
227 ],
228 ]
229 );
230 }
231 }
232