PluginProbe
Elementor Website Builder – more than just a page builder / 3.10.0-dev1
Elementor Website Builder – more than just a page builder v3.10.0-dev1
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-form-fields.php

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

228 lines 5.0 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' ),
138 'type' => Controls_Manager::SLIDER,
139 'size_units' => [ 's', 'ms' ],
140 'default' => [
141 'unit' => 'ms',
142 ],
143 'selectors' => [
144 $input_selector => 'transition: {{SIZE}}{{UNIT}}',
145 ],
146 ]
147 );
148
149 $this->end_controls_tab();
150
151 $this->end_controls_tabs();
152
153 $this->add_responsive_control(
154 'form_field_padding',
155 [
156 'label' => esc_html__( 'Padding', 'elementor' ),
157 'type' => Controls_Manager::DIMENSIONS,
158 'size_units' => [ 'px', 'em', '%' ],
159 'selectors' => [
160 $input_selector => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
161 ],
162 'separator' => 'before',
163 ]
164 );
165
166 $this->end_controls_section();
167 }
168
169 private function add_form_field_state_tab_controls( $prefix, $selector ) {
170 $this->add_control(
171 $prefix . '_text_color',
172 [
173 'label' => esc_html__( 'Text Color', 'elementor' ),
174 'type' => Controls_Manager::COLOR,
175 'dynamic' => [],
176 'selectors' => [
177 $selector => 'color: {{VALUE}};',
178 ],
179 ]
180 );
181
182 $this->add_control(
183 $prefix . '_background_color',
184 [
185 'label' => esc_html__( 'Background Color', 'elementor' ),
186 'type' => Controls_Manager::COLOR,
187 'dynamic' => [],
188 'selectors' => [
189 $selector => 'background-color: {{VALUE}};',
190 ],
191 ]
192 );
193
194 $this->add_group_control(
195 Group_Control_Box_Shadow::get_type(),
196 [
197 'name' => $prefix . '_box_shadow',
198 'selector' => $selector,
199 ]
200 );
201
202 $this->add_group_control(
203 Group_Control_Border::get_type(),
204 [
205 'name' => $prefix . '_border',
206 'selector' => $selector,
207 'fields_options' => [
208 'color' => [
209 'dynamic' => [],
210 ],
211 ],
212 ]
213 );
214
215 $this->add_control(
216 $prefix . '_border_radius',
217 [
218 'label' => esc_html__( 'Border Radius', 'elementor' ),
219 'type' => Controls_Manager::DIMENSIONS,
220 'size_units' => [ 'px', '%', 'em' ],
221 'selectors' => [
222 $selector => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
223 ],
224 ]
225 );
226 }
227 }
228