PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.1.0
ShopBuilder – WooCommerce Builder For Elementor v2.1.0
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 / AddToCartSettings.php

AddToCartSettings.php in ShopBuilder – WooCommerce Builder For Elementor 2.1.0, at app/Elementor/Widgets/Controls/AddToCartSettings.php

472 lines 13.4 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\Widgets\Controls\ButtonSettings;
12 use RadiusTheme\SB\Helpers\Fns;
13
14 // Do not allow directly accessing this file.
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit( 'This script cannot be accessed directly.' );
17 }
18
19 /**
20 * Product Description class
21 */
22 class AddToCartSettings {
23 /**
24 * Widget Control Selectors
25 *
26 * @var object
27 */
28 private static $widget = [];
29 /**
30 * Widget Control Selectors
31 *
32 * @var array
33 */
34 private static $selectors = [];
35 /**
36 * Widget Field
37 *
38 * @return array
39 */
40 public static function widget_fields( $widget ) {
41 self::$widget = $widget;
42 self::$selectors = $widget->selectors;
43 return QuantityFields::quantity_fields( $widget ) +
44 self::add_to_cart_fields() +
45 self::add_to_cart_style() +
46 self::product_price_style_fields() +
47 QuantityFields::quantity_style_fields( $widget ) +
48 self::variation_style_fields();
49 }
50
51 /**
52 * Widget Field
53 *
54 * @return array
55 */
56 public static function add_to_cart_fields() {
57 $fields = [
58 'sec_add_to_cart' => [
59 'mode' => 'section_start',
60 'label' => esc_html__( 'Add to cart', 'shopbuilder' ),
61 ],
62
63 'cart_icon' => [
64 'label' => esc_html__( 'Cart Icon', 'shopbuilder' ),
65 'type' => 'icons',
66 'separator' => 'default',
67 ],
68 'cart_icon_align' => [
69 'mode' => 'responsive',
70 'label' => esc_html__( 'Icon Alignment', 'shopbuilder' ),
71 'type' => 'choose',
72 'options' => [
73 '0' => [
74 'title' => esc_html__( 'Left', 'shopbuilder' ),
75 'icon' => 'fas fa-arrow-left',
76 ],
77 '1' => [
78 'title' => esc_html__( 'Right', 'shopbuilder' ),
79 'icon' => 'fas fa-arrow-right',
80 ],
81 ],
82 'default' => '0',
83 'condition' => [
84 'quantity_style!' => 'default',
85 ],
86 'selectors' => [
87 self::$selectors['cart_icon_align'] => 'order: {{VALUE}};',
88 ],
89 ],
90 'cart_icon_gap' => [
91 'label' => esc_html__( 'Gap', 'shopbuilder' ),
92 'type' => 'slider',
93 'mode' => 'responsive',
94 'range' => [
95 'px' => [
96 'min' => 0,
97 'max' => 100,
98 ],
99 ],
100 'selectors' => [
101 self::$selectors['cart_icon_gap'] => 'gap: {{SIZE}}{{UNIT}};',
102 ],
103 ],
104 'add_to_cart_end' => [
105 'mode' => 'section_end',
106 ],
107 ];
108 return $fields;
109 }
110 /**
111 * Widget Field
112 *
113 * @return array
114 */
115 public static function add_to_cart_style() {
116 $fields = ButtonSettings::style_settings( self::$widget );
117 $insert_array = [
118 'cart_icon_size' => [
119 'label' => esc_html__( 'Icon size', 'shopbuilder' ),
120 'type' => 'slider',
121 'separator' => 'default',
122 'range' => [
123 'px' => [
124 'min' => 10,
125 'max' => 50,
126 ],
127 ],
128 'selectors' => [
129 self::$selectors['cart_icon_size'] => 'font-size: {{SIZE}}{{UNIT}};',
130 ],
131 ],
132 ];
133 $fields = Fns::insert_controls( 'button_padding', $fields, $insert_array );
134 return $fields;
135 }
136
137 /**
138 * Widget Field
139 *
140 * @return array
141 */
142 public static function quantity_style_fields() {
143 $fields = [
144 'quantity_section' => [
145 'mode' => 'section_start',
146 'tab' => 'style',
147 'label' => esc_html__( 'Quantity', 'shopbuilder' ),
148 ],
149 'quantity_style_heading' => [
150 'type' => 'html',
151 'raw' => sprintf(
152 '<h3 class="rtsb-elementor-group-heading">%s</h3>',
153 esc_html__( 'Quantity Style', 'shopbuilder' )
154 ),
155 'content_classes' => 'elementor-panel-heading-title',
156 'condition' => [
157 'quantity_style' => [ 'style-1', 'style-2' ],
158 ],
159 ],
160 'icon_size' => [
161 'label' => esc_html__( 'Icon size', 'shopbuilder' ),
162 'type' => 'slider',
163 'separator' => 'default',
164 'range' => [
165 'px' => [
166 'min' => 10,
167 'max' => 50,
168 ],
169 ],
170 'default' => [
171 'size' => 15,
172 ],
173 'selectors' => [
174 self::$selectors['icon_size'] => 'font-size: {{SIZE}}{{UNIT}};',
175 ],
176 ],
177 'quantitybox_border_color' => [
178 'label' => esc_html__( 'Border Color', 'shopbuilder' ),
179 'type' => 'color',
180 'selectors' => [
181 self::$selectors['quantitybox_border_color'] => 'border-color: {{VALUE}}',
182 ],
183 ],
184 'quantity_icon_tabs_start' => [
185 'mode' => 'tabs_start',
186 ],
187 // Tab For normal view.
188 'quantity_icon_normal' => [
189 'mode' => 'tab_start',
190 'label' => esc_html__( 'Normal', 'shopbuilder' ),
191 ],
192 'quantity_icon_color' => [
193 'label' => esc_html__( 'Quantity icon Color', 'shopbuilder' ),
194 'type' => 'color',
195 'separator' => 'default',
196 'selectors' => [
197 self::$selectors['quantity_icon_color'] => 'color: {{VALUE}}',
198 ],
199 ],
200 'quantity_icon_normal_end' => [
201 'mode' => 'tab_end',
202 ],
203 'quantity_icon_hover' => [
204 'mode' => 'tab_start',
205 'label' => esc_html__( 'Hover', 'shopbuilder' ),
206 ],
207 'quantity_icon_hover_color' => [
208 'label' => esc_html__( 'Quantity icon Color', 'shopbuilder' ),
209 'type' => 'color',
210 'separator' => 'default',
211 'selectors' => [
212 self::$selectors['quantity_icon_hover_color'] => 'color: {{VALUE}}',
213 ],
214 ],
215 'quantity_icon_hover_end' => [
216 'mode' => 'tab_end',
217 ],
218 'quantity_icon_tabs_end' => [
219 'mode' => 'tabs_end',
220 ],
221
222 'text_typography' => [
223 'type' => 'typography',
224 'separator' => 'before',
225 'mode' => 'group',
226 'label' => esc_html__( 'Typography', 'shopbuilder' ),
227 'description' => esc_html__( 'Only for Quantity Label.', 'shopbuilder' ),
228 'selector' => self::$selectors['text_typography'],
229 ],
230 'quantity_number_color' => [
231 'label' => esc_html__( 'Quantity Number', 'shopbuilder' ),
232 'type' => 'color',
233 'selectors' => [
234 self::$selectors['quantity_number_color'] => 'color: {{VALUE}}',
235 ],
236 ],
237 'quantity_background_color' => [
238 'label' => esc_html__( 'Quantity Backgeound', 'shopbuilder' ),
239 'type' => 'color',
240 'selectors' => [
241 self::$selectors['quantity_background_color'] => 'background: {{VALUE}}',
242 ],
243 ],
244 'quantity_border' => [
245 'mode' => 'group',
246 'type' => 'border',
247 'label' => esc_html__( 'Quantity Border', 'shopbuilder' ),
248 'selector' => self::$selectors['quantity_border'],
249 ],
250 'quantity_radius' => [
251 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
252 'size_units' => [ 'px', '%' ],
253 'type' => 'dimensions',
254 'selectors' => [
255 self::$selectors['quantity_radius'] => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
256 ],
257 ],
258 'qunatity_padding' => [
259 'label' => esc_html__( 'Padding', 'shopbuilder' ),
260 'type' => 'dimensions',
261 'mode' => 'responsive',
262 'size_units' => [ 'px', '%', 'em' ],
263 'selectors' => [
264 self::$selectors['qunatity_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
265 ],
266 ],
267 'quantity_style_wrapper_heading' => [
268 'type' => 'html',
269 'raw' => sprintf(
270 '<h3 class="rtsb-elementor-group-heading">%s</h3>',
271 esc_html__( 'Quantity Wrapper Style', 'shopbuilder' )
272 ),
273 'content_classes' => 'elementor-panel-heading-title',
274 'condition' => [
275 'quantity_style' => [ 'style-1', 'style-2' ],
276 ],
277 ],
278 'quantity_wrapper_background_color' => [
279 'label' => esc_html__( 'Background', 'shopbuilder' ),
280 'type' => 'color',
281 'selectors' => [
282 self::$selectors['quantity_wrapper_background_color'] => 'background: {{VALUE}}',
283 ],
284 'condition' => [
285 'quantity_style' => [ 'style-1', 'style-2' ],
286 ],
287 ],
288 'quantity_wrapper_radius' => [
289 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
290 'size_units' => [ 'px', '%' ],
291 'type' => 'dimensions',
292 'selectors' => [
293 self::$selectors['quantity_wrapper_radius'] => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
294 ],
295 'condition' => [
296 'quantity_style' => [ 'style-1', 'style-2' ],
297 ],
298 ],
299 'qunatity_wrapper_padding' => [
300 'label' => esc_html__( 'Padding', 'shopbuilder' ),
301 'type' => 'dimensions',
302 'mode' => 'responsive',
303 'size_units' => [ 'px', '%', 'em' ],
304 'selectors' => [
305 self::$selectors['qunatity_wrapper_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
306 ],
307 ],
308 'quantity_section_end' => [
309 'mode' => 'section_end',
310 ],
311 ];
312 return $fields;
313 }
314
315 /**
316 * Widget Field
317 *
318 * @return array
319 */
320 public static function variation_style_fields() {
321 $fields = [
322 'variation_section' => [
323 'mode' => 'section_start',
324 'tab' => 'style',
325 'label' => esc_html__( 'Variations', 'shopbuilder' ),
326 ],
327 'variation_label_typography' => [
328 'type' => 'typography',
329 'separator' => 'before',
330 'mode' => 'group',
331 'label' => esc_html__( 'Label Typography', 'shopbuilder' ),
332 'description' => esc_html__( 'Only for Variation Label.', 'shopbuilder' ),
333 'selector' => self::$selectors['variation_label_typography'],
334 ],
335 'variation_label_color' => [
336 'label' => esc_html__( 'Color', 'shopbuilder' ),
337 'type' => 'color',
338 'selectors' => [
339 self::$selectors['variation_label_color'] => 'color: {{VALUE}}',
340 ],
341 ],
342 'variation_height' => [
343 'label' => esc_html__( 'Height', 'shopbuilder' ),
344 'type' => 'slider',
345 'range' => [
346 'px' => [
347 'min' => 10,
348 'max' => 200,
349 ],
350 ],
351 'selectors' => [
352 self::$selectors['variation_height'] => 'height: {{SIZE}}{{UNIT}};',
353 ],
354 ],
355 'variation_width' => [
356 'label' => esc_html__( 'Width', 'shopbuilder' ),
357 'size_units' => [ 'px', '%' ],
358 'type' => 'slider',
359 'range' => [
360 'px' => [
361 'min' => 10,
362 'max' => 900,
363 ],
364 '%' => [
365 'min' => 0,
366 'max' => 100,
367 ],
368 ],
369 'selectors' => [
370 self::$selectors['variation_width'] => 'width: {{SIZE}}{{UNIT}};',
371 ],
372 ],
373 'variation_border' => [
374 'mode' => 'group',
375 'type' => 'border',
376 'label' => esc_html__( 'Quantity Border', 'shopbuilder' ),
377 'selector' => self::$selectors['variation_border'],
378 ],
379 'variation_border_radius' => [
380 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
381 'size_units' => [ 'px', '%' ],
382 'type' => 'slider',
383 'selectors' => [
384 self::$selectors['variation_border_radius'] => 'border-radius: {{SIZE}}{{UNIT}};',
385 ],
386 ],
387 'variation_padding' => [
388 'label' => esc_html__( 'Padding', 'shopbuilder' ),
389 'type' => 'dimensions',
390 'size_units' => [ 'px' ],
391 'default' => [
392 'top' => '10',
393 'right' => '10',
394 'bottom' => '10',
395 'left' => '10',
396 'unit' => 'px',
397 'isLinked' => true,
398 ],
399 'separator' => 'default',
400 'selectors' => [
401 self::$selectors['variation_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
402 ],
403 ],
404 'variation_label_margin' => [
405 'label' => esc_html__( 'Label Margin', 'shopbuilder' ),
406 'type' => 'dimensions',
407 'size_units' => [ 'px', '%', 'em' ],
408 'selectors' => [
409 self::$selectors['variation_label_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
410 ],
411 ],
412 'variation_item_margin' => [
413 'label' => esc_html__( 'Variation Item Margin', 'shopbuilder' ),
414 'type' => 'dimensions',
415 'size_units' => [ 'px', '%', 'em' ],
416 'selectors' => [
417 self::$selectors['variation_item_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
418 ],
419 ],
420 'variation_section_end' => [
421 'mode' => 'section_end',
422 ],
423 'variation_section_end' => [
424 'mode' => 'section_end',
425 ],
426 ];
427 return $fields;
428 }
429
430 /**
431 * Widget Field
432 *
433 * @return array
434 */
435 public static function product_price_style_fields() {
436 return [
437 'price_section_style_start' => [
438 'mode' => 'section_start',
439 'tab' => 'style',
440 'label' => esc_html__( 'Price', 'shopbuilder' ),
441 ],
442 'price_typography' => [
443 'type' => 'typography',
444 'separator' => 'before',
445 'mode' => 'group',
446 'label' => esc_html__( 'Typography', 'shopbuilder' ),
447 'description' => esc_html__( 'Only for Variation Price', 'shopbuilder' ),
448 'selector' => self::$selectors['price_typography'],
449 ],
450 'price_color' => [
451 'label' => esc_html__( 'Color', 'shopbuilder' ),
452 'type' => 'color',
453 'selectors' => [
454 self::$selectors['price_color'] => 'color: {{VALUE}}',
455 ],
456 ],
457 'price_margin' => [
458 'label' => esc_html__( 'Margin', 'shopbuilder' ),
459 'type' => 'dimensions',
460 'size_units' => [ 'px' ],
461 'separator' => 'default',
462 'selectors' => [
463 self::$selectors['price_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
464 ],
465 ],
466 'price_section_style_end' => [
467 'mode' => 'section_end',
468 ],
469 ];
470 }
471 }
472