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

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