PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.3
ShopBuilder – WooCommerce Builder For Elementor v3.2.3
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
shopbuilder / app / Elementor / Widgets / Controls / QuantityFields.php

QuantityFields.php in ShopBuilder – WooCommerce Builder For Elementor 3.2.3, at app/Elementor/Widgets/Controls/QuantityFields.php

323 lines 9.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Main ProductDescription class.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Elementor\Widgets\Controls;
9
10 use Elementor\Controls_Manager;
11 use RadiusTheme\SB\Elementor\Helper\ControlHelper;
12
13 // Do not allow directly accessing this file.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit( 'This script cannot be accessed directly.' );
16 }
17
18 /**
19 * Product Description class
20 */
21 class QuantityFields {
22
23 /**
24 * Widget Field
25 *
26 * @return array
27 */
28 public static function quantity_fields( $widget ) {
29 $fields = [
30 'sec_quantity' => [
31 'mode' => 'section_start',
32 'label' => esc_html__( 'Quantity', 'shopbuilder' ),
33 ],
34 // TODO:: Control Type will be select image.
35 'quantity_style' => [
36 'label' => esc_html__( 'Style', 'shopbuilder' ),
37 'type' => 'select',
38 'options' => [
39 'default' => esc_html__( 'Default', 'shopbuilder' ),
40 'style-2' => esc_html__( 'Style 1', 'shopbuilder' ),
41 'style-3' => esc_html__( 'Style 2', 'shopbuilder' ),
42 'style-4' => esc_html__( 'Style 3', 'shopbuilder' ),
43 ],
44 'separator' => 'default',
45 'default' => 'default',
46 ],
47 'show_inner_border' => [
48 'label' => esc_html__( 'Show Inner Border?', 'shopbuilder' ),
49 'type' => 'switch',
50 'description' => esc_html__( 'Switch on to Show inner border.', 'shopbuilder' ),
51 'default' => 'yes',
52 'condition' => [
53 'quantity_style' => [ 'style-3', 'style-4' ],
54 ],
55 ],
56 'quantity_input_width' => [
57 'label' => esc_html__( 'Quantity Field Width', 'shopbuilder' ),
58 'type' => 'slider',
59 'range' => [
60 'px' => [
61 'min' => 30,
62 'max' => 100,
63 ],
64 ],
65 'selectors' => [
66 $widget->selectors['quantity_input_width'] => 'width: {{SIZE}}{{UNIT}};',
67 ],
68 ],
69 'quantity_button_width' => [
70 'label' => esc_html__( 'Quantity Button Width', 'shopbuilder' ),
71 'type' => 'slider',
72 'range' => [
73 'px' => [
74 'min' => 20,
75 'max' => 100,
76 ],
77 ],
78 'selectors' => [
79 $widget->selectors['quantity_button_width'] => 'width: {{SIZE}}{{UNIT}};',
80 ],
81 ],
82 'quantity_height' => [
83 'label' => esc_html__( 'Quantity Height', 'shopbuilder' ),
84 'type' => 'slider',
85 'range' => [
86 'px' => [
87 'min' => 10,
88 'max' => 200,
89 ],
90 ],
91 'default' => [
92 'size' => 50,
93 ],
94 'selectors' => [
95 $widget->selectors['quantity_height']['full'] => 'height: {{SIZE}}{{UNIT}};',
96 $widget->selectors['quantity_height']['half'] => 'height: calc( {{SIZE}}{{UNIT}} / 2 );',
97 ],
98 ],
99 'increment_icon' => [
100 'label' => esc_html__( 'Increment Icon', 'shopbuilder' ),
101 'type' => 'icons',
102 'default' => [
103 'value' => 'fas fa-plus',
104 'library' => 'fa-solid',
105 ],
106 'condition' => [
107 'quantity_style!' => 'default',
108 ],
109 ],
110 'decrement_icon' => [
111 'label' => esc_html__( 'Decrement Icon', 'shopbuilder' ),
112 'type' => 'icons',
113 'default' => [
114 'value' => 'fas fa-minus',
115 'library' => 'fa-solid',
116 ],
117 'condition' => [
118 'quantity_style!' => 'default',
119 ],
120 ],
121 'quantity_style_end' => [
122 'mode' => 'section_end',
123 ],
124 ];
125 return $fields;
126 }
127
128 /**
129 * Widget Field
130 *
131 * @return array
132 */
133 public static function quantity_style_fields( $widget ) {
134 $fields = [
135 'quantity_section' => [
136 'mode' => 'section_start',
137 'tab' => 'style',
138 'label' => esc_html__( 'Quantity', 'shopbuilder' ),
139 ],
140 'quantity_style_heading' => [
141 'type' => 'html',
142 'raw' => sprintf(
143 '<h3 class="rtsb-elementor-group-heading">%s</h3>',
144 esc_html__( 'Quantity Field Style', 'shopbuilder' )
145 ),
146 'content_classes' => 'elementor-panel-heading-title',
147 'condition' => [
148 'quantity_style' => [ 'style-1', 'style-2' ],
149 ],
150 ],
151 'icon_size' => [
152 'label' => esc_html__( 'Icon size', 'shopbuilder' ),
153 'type' => 'slider',
154 'separator' => 'default',
155 'range' => [
156 'px' => [
157 'min' => 10,
158 'max' => 50,
159 ],
160 ],
161 'default' => [
162 'size' => 15,
163 ],
164 'selectors' => [
165 $widget->selectors['icon_size']['icon'] => 'font-size: {{SIZE}}{{UNIT}};',
166 $widget->selectors['icon_size']['svg'] => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
167 ],
168 ],
169 'quantitybox_border_color' => [
170 'label' => esc_html__( 'Border Color', 'shopbuilder' ),
171 'type' => 'color',
172 'selectors' => [
173 '{{WRAPPER}} .rtsb-quantity-box-group' => '--rtsb-quantity-border-color: {{VALUE}}',
174 ],
175 ],
176
177 'quantity_icon_tabs_start' => [
178 'mode' => 'tabs_start',
179 ],
180 // Tab For normal view.
181 'quantity_icon_normal' => [
182 'mode' => 'tab_start',
183 'label' => esc_html__( 'Normal', 'shopbuilder' ),
184 ],
185 'quantity_icon_color' => [
186 'label' => esc_html__( 'Quantity icon Color', 'shopbuilder' ),
187 'type' => 'color',
188 'separator' => 'default',
189 'selectors' => [
190 $widget->selectors['quantity_icon_color'] => 'color: {{VALUE}}',
191 ],
192 ],
193 'quantity_icon_normal_end' => [
194 'mode' => 'tab_end',
195 ],
196 'quantity_icon_hover' => [
197 'mode' => 'tab_start',
198 'label' => esc_html__( 'Hover', 'shopbuilder' ),
199 ],
200 'quantity_icon_hover_color' => [
201 'label' => esc_html__( 'Quantity icon Color', 'shopbuilder' ),
202 'type' => 'color',
203 'separator' => 'default',
204 'selectors' => [
205 $widget->selectors['quantity_icon_hover_color'] => 'color: {{VALUE}}',
206 ],
207 ],
208 'quantity_icon_hover_end' => [
209 'mode' => 'tab_end',
210 ],
211 'quantity_icon_tabs_end' => [
212 'mode' => 'tabs_end',
213 ],
214
215 'text_typography' => [
216 'type' => 'typography',
217 'separator' => 'before',
218 'mode' => 'group',
219 'label' => esc_html__( 'Typography', 'shopbuilder' ),
220 'description' => esc_html__( 'Only for Quantity Label.', 'shopbuilder' ),
221 'selector' => $widget->selectors['text_typography'],
222 ],
223 'quantity_number_color' => [
224 'label' => esc_html__( 'Quantity Number', 'shopbuilder' ),
225 'type' => 'color',
226 'selectors' => [
227 $widget->selectors['quantity_number_color'] => 'color: {{VALUE}}',
228 ],
229 ],
230 'quantity_background_color' => [
231 'label' => esc_html__( 'Quantity Backgeound', 'shopbuilder' ),
232 'type' => 'color',
233 'selectors' => [
234 $widget->selectors['quantity_background_color'] => 'background: {{VALUE}}',
235 ],
236 ],
237 'quantity_border' => [
238 'mode' => 'group',
239 'type' => 'border',
240 'fields_options' => [
241 'border' => [
242 'label' => esc_html__( 'Quantity Field Border', 'shopbuilder' ),
243 'label_block' => true,
244 ],
245 'color' => [
246 'label' => esc_html__( 'Border Color', 'shopbuilder' ),
247 ],
248 ],
249 'selector' => $widget->selectors['quantity_border'],
250 ],
251 'quantity_radius' => [
252 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
253 'size_units' => [ 'px', '%' ],
254 'type' => 'dimensions',
255 'selectors' => [
256 $widget->selectors['quantity_radius'] => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
257 ],
258 ],
259 'qunatity_padding' => [
260 'label' => esc_html__( 'Field Padding', 'shopbuilder' ),
261 'type' => 'dimensions',
262 'size_units' => [ 'px', '%', 'em' ],
263 'selectors' => [
264 $widget->selectors['qunatity_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
265 ],
266 ],
267 'quantity_increment_button_padding' => [
268 'label' => esc_html__( 'Quantity Increment Button Padding', 'shopbuilder' ),
269 'type' => 'dimensions',
270 'size_units' => [ 'px' ],
271 'selectors' => [
272 $widget->selectors['quantity_increment_button_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
273 ],
274 ],
275 'quantity_decrement_button_padding' => [
276 'label' => esc_html__( 'Quantity Increment Button Padding', 'shopbuilder' ),
277 'type' => 'dimensions',
278 'size_units' => [ 'px' ],
279 'selectors' => [
280 $widget->selectors['quantity_decrement_button_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
281 ],
282 ],
283
284 'quantity_style_wrapper_heading' => [
285 'type' => 'html',
286 'raw' => sprintf(
287 '<h3 class="rtsb-elementor-group-heading">%s</h3>',
288 esc_html__( 'Quantity Wrapper Style', 'shopbuilder' )
289 ),
290 'content_classes' => 'elementor-panel-heading-title',
291 ],
292 'quantity_wrapper_background_color' => [
293 'label' => esc_html__( 'Background', 'shopbuilder' ),
294 'type' => 'color',
295 'selectors' => [
296 $widget->selectors['quantity_wrapper_background_color'] => 'background: {{VALUE}}',
297 ],
298
299 ],
300 'quantity_wrapper_radius' => [
301 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
302 'size_units' => [ 'px', '%' ],
303 'type' => 'dimensions',
304 'selectors' => [
305 $widget->selectors['quantity_wrapper_radius'] => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
306 ],
307 ],
308 'qunatity_wrapper_padding' => [
309 'label' => esc_html__( 'Padding', 'shopbuilder' ),
310 'type' => 'dimensions',
311 'size_units' => [ 'px', '%', 'em' ],
312 'selectors' => [
313 $widget->selectors['qunatity_wrapper_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
314 ],
315 ],
316 'quantity_section_end' => [
317 'mode' => 'section_end',
318 ],
319 ];
320 return $fields;
321 }
322 }
323