PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.6.0
ShopBuilder – WooCommerce Builder For Elementor v2.6.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 / SettingsFields.php

SettingsFields.php in ShopBuilder – WooCommerce Builder For Elementor 2.6.0, at app/Elementor/Widgets/Controls/SettingsFields.php

1,719 lines 57.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Elementor Settings Fields Class.
4 *
5 * This class contains all the common fields for Settings tab.
6 *
7 * @package RadiusTheme\SB
8 */
9
10 namespace RadiusTheme\SB\Elementor\Widgets\Controls;
11
12 use RadiusTheme\SB\Helpers\Fns;
13 use RadiusTheme\SB\Elementor\Helper\ControlHelper;
14
15 // Do not allow directly accessing this file.
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit( 'This script cannot be accessed directly.' );
18 }
19
20 /**
21 * Elementor Settings Fields Class.
22 */
23 class SettingsFields {
24 /**
25 * Tab name.
26 *
27 * @access private
28 * @static
29 *
30 * @var array
31 */
32 private static $tab = 'settings';
33
34 /**
35 * Visibility section
36 *
37 * @param object $obj Reference object.
38 *
39 * @return array
40 */
41 public static function content_visibility( $obj ) {
42 $fields['visibility_section'] = $obj->start_section(
43 esc_html__( 'Content Visibility', 'shopbuilder' ),
44 self::$tab
45 );
46
47 $fields['general_visibility'] = $obj->el_heading( esc_html__( 'General Visibility', 'shopbuilder' ) );
48
49 $fields['show_title'] = [
50 'type' => 'switch',
51 'label' => esc_html__( 'Show Product Title?', 'shopbuilder' ),
52 'description' => esc_html__( 'Switch on to show product title.', 'shopbuilder' ),
53 'label_on' => esc_html__( 'On', 'shopbuilder' ),
54 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
55 'default' => 'yes',
56 ];
57
58 $fields['show_short_desc'] = [
59 'type' => 'switch',
60 'label' => esc_html__( 'Show Short Description?', 'shopbuilder' ),
61 'description' => esc_html__( 'Switch on to show product short description.', 'shopbuilder' ),
62 'label_on' => esc_html__( 'On', 'shopbuilder' ),
63 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
64 'condition' => [ 'layout!' => [ 'grid-layout2', 'slider-layout2' ] ],
65 ];
66
67 $fields['show_price'] = [
68 'type' => 'switch',
69 'label' => esc_html__( 'Show Product Price?', 'shopbuilder' ),
70 'description' => esc_html__( 'Switch on to show product price.', 'shopbuilder' ),
71 'label_on' => esc_html__( 'On', 'shopbuilder' ),
72 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
73 'default' => 'yes',
74 ];
75
76 $fields['show_rating'] = [
77 'type' => 'switch',
78 'label' => esc_html__( 'Show Product Rating?', 'shopbuilder' ),
79 'description' => esc_html__( 'Switch on to show product rating.', 'shopbuilder' ),
80 'label_on' => esc_html__( 'On', 'shopbuilder' ),
81 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
82 'default' => 'yes',
83 ];
84
85 $fields['show_badges'] = [
86 'type' => 'switch',
87 'label' => esc_html__( 'Show Product Badges?', 'shopbuilder' ),
88 'description' => esc_html__( 'Switch on to show product badges.', 'shopbuilder' ),
89 'label_on' => esc_html__( 'On', 'shopbuilder' ),
90 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
91 'default' => 'yes',
92 ];
93
94 $fields['show_categories'] = [
95 'type' => 'switch',
96 'label' => esc_html__( 'Show Product Categories?', 'shopbuilder' ),
97 'description' => esc_html__( 'Switch on to show product categories.', 'shopbuilder' ),
98 'label_on' => esc_html__( 'On', 'shopbuilder' ),
99 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
100 'condition' => [ 'layout!' => [ 'grid-layout2', 'slider-layout2' ] ],
101 ];
102
103 $fields['single_category'] = [
104 'type' => 'switch',
105 'label' => esc_html__( 'Show Only First Category?', 'shopbuilder' ),
106 'description' => esc_html__( 'Switch on to show only the first category.', 'shopbuilder' ),
107 'label_on' => esc_html__( 'On', 'shopbuilder' ),
108 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
109 'default' => 'yes',
110 'condition' => [
111 'show_categories' => [ 'yes' ],
112 'layout!' => [ 'grid-layout2', 'slider-layout2' ],
113 ],
114 ];
115
116 $fields['action_btn_visibility'] = $obj->el_heading( esc_html__( 'Action Buttons Visibility', 'shopbuilder' ), 'before' );
117
118 $fields['show_add_to_cart'] = [
119 'type' => 'switch',
120 'label' => esc_html__( 'Show Add to Cart Button?', 'shopbuilder' ),
121 'description' => esc_html__( 'Switch on to show product add to cart.', 'shopbuilder' ),
122 'label_on' => esc_html__( 'On', 'shopbuilder' ),
123 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
124 'default' => 'yes',
125 ];
126
127 $wishlist = Fns::get_options( 'modules', 'wishlist' );
128 $compare = Fns::get_options( 'modules', 'compare' );
129 $quick_view = Fns::get_options( 'modules', 'quick_view' );
130
131 if ( 'on' === ( $wishlist['active'] ?? '' ) ) {
132 $fields['show_wishlist'] = [
133 'type' => 'switch',
134 'label' => esc_html__( 'Show Wishlist Button?', 'shopbuilder' ),
135 'description' => esc_html__( 'Switch on to show product wishlist.', 'shopbuilder' ),
136 'label_on' => esc_html__( 'On', 'shopbuilder' ),
137 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
138 'default' => 'yes',
139 ];
140 }
141
142 if ( 'on' === ( $quick_view['active'] ?? '' ) ) {
143 $fields['show_quick_view'] = [
144 'type' => 'switch',
145 'label' => esc_html__( 'Show Quick View Button?', 'shopbuilder' ),
146 'description' => esc_html__( 'Switch on to show product quick view.', 'shopbuilder' ),
147 'label_on' => esc_html__( 'On', 'shopbuilder' ),
148 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
149 'default' => 'yes',
150 ];
151 }
152
153 if ( 'on' === ( $compare['active'] ?? '' ) ) {
154 $fields['show_compare'] = [
155 'type' => 'switch',
156 'label' => esc_html__( 'Show Compare Button?', 'shopbuilder' ),
157 'description' => esc_html__( 'Switch on to show product compare.', 'shopbuilder' ),
158 'label_on' => esc_html__( 'On', 'shopbuilder' ),
159 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
160 ];
161 }
162
163 $fields['visibility_section_end'] = $obj->end_section();
164
165 return apply_filters( 'rtsb/elements/elementor/visibility_control', $fields, $obj );
166 }
167
168 /**
169 * Content ordering section
170 *
171 * @param object $obj Reference object.
172 *
173 * @return array
174 */
175 public static function content_ordering( $obj ) {
176 $fields['ordering_section'] = $obj->start_section(
177 esc_html__( 'Content Ordering', 'shopbuilder' ),
178 self::$tab
179 );
180
181 $fields['ordering_note'] = [
182 'type' => 'html',
183 'raw' => '',
184 'content_classes' => 'elementor-panel-heading-title',
185 ];
186
187 $fields['custom_ordering'] = [
188 'type' => 'switch',
189 'label' => esc_html__( 'Enable Custom Ordering?', 'shopbuilder' ),
190 'description' => esc_html__( 'Switch on to enable elements custom ordering.', 'shopbuilder' ),
191 'label_on' => esc_html__( 'On', 'shopbuilder' ),
192 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
193 'separator' => $obj->pro_class(),
194 'classes' => $obj->pro_class(),
195 'condition' => [
196 'layout!' => [ 'grid-layout4', 'list-layout5', 'list-layout6', 'slider-layout4', 'slider-layout8' ],
197 ],
198 ];
199
200 $fields['ordering_section_end'] = $obj->end_section();
201
202 return apply_filters( 'rtsb/elementor/ordering_control', $fields, $obj );
203 }
204
205 /**
206 * Action buttons section
207 *
208 * @param object $obj Reference object.
209 *
210 * @return array
211 */
212 public static function action_buttons( $obj ) {
213 $fields['action_visibility_section'] = $obj->start_section(
214 esc_html__( 'Action Buttons', 'shopbuilder' ),
215 self::$tab
216 );
217
218 $fields['add_to_cart_note'] = $obj->el_heading(
219 esc_html__( 'Add to Cart Button', 'shopbuilder' ),
220 'default',
221 [],
222 [ 'show_add_to_cart' => [ 'yes' ] ]
223 );
224
225 // TODO:: Variable product button text change option.
226 $fields['show_cart_text'] = [
227 'type' => 'switch',
228 'label' => esc_html__( 'Show Add to Cart Text?', 'shopbuilder' ),
229 'description' => esc_html__( 'Switch on to show add to cart text.', 'shopbuilder' ),
230 'label_on' => esc_html__( 'On', 'shopbuilder' ),
231 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
232 'default' => 'yes',
233 'condition' => [ 'show_add_to_cart' => [ 'yes' ] ],
234 ];
235
236 $fields['add_to_cart_text'] = [
237 'type' => 'text',
238 'label' => esc_html__( 'Add to Cart Text', 'shopbuilder' ),
239 'default' => esc_html__( 'Add to Cart', 'shopbuilder' ),
240 'description' => esc_html__( 'Please enter the add to cart text.', 'shopbuilder' ),
241 'condition' => [
242 'show_cart_text' => [ 'yes' ],
243 'show_add_to_cart' => [ 'yes' ],
244 ],
245 'label_block' => true,
246 ];
247
248 $fields['add_to_cart_success_text'] = [
249 'type' => 'text',
250 'label' => esc_html__( 'Add to Cart Success Text', 'shopbuilder' ),
251 'default' => esc_html__( 'Added!', 'shopbuilder' ),
252 'description' => esc_html__( 'Please enter the add to cart success text.', 'shopbuilder' ),
253 'condition' => [
254 'show_cart_text' => [ 'yes' ],
255 'show_add_to_cart' => [ 'yes' ],
256 ],
257 'label_block' => true,
258 ];
259
260 $fields['show_cart_icon'] = [
261 'type' => 'switch',
262 'label' => esc_html__( 'Show Add to Cart Icon?', 'shopbuilder' ),
263 'description' => esc_html__( 'Switch on to show add to cart icon.', 'shopbuilder' ),
264 'label_on' => esc_html__( 'On', 'shopbuilder' ),
265 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
266 'default' => 'yes',
267 'condition' => [ 'show_add_to_cart' => [ 'yes' ] ],
268 ];
269
270 $fields['add_to_cart_icon'] = [
271 'type' => 'icons',
272 'label' => esc_html__( 'Choose Add to Cart Icon', 'shopbuilder' ),
273 'default' => [
274 'value' => 'rtsb-icon rtsb-icon-cart',
275 'library' => 'rtsb-fonts',
276 ],
277 'condition' => [
278 'show_cart_icon' => [ 'yes' ],
279 'show_add_to_cart' => [ 'yes' ],
280 ],
281 ];
282
283 $fields['add_to_cart_success_icon'] = [
284 'type' => 'icons',
285 'label' => esc_html__( 'Choose Add to Cart Success Icon', 'shopbuilder' ),
286 'default' => [
287 'value' => 'rtsb-icon rtsb-icon-check',
288 'library' => 'rtsb-fonts',
289 ],
290 'condition' => [
291 'show_cart_icon' => [ 'yes' ],
292 'show_add_to_cart' => [ 'yes' ],
293 ],
294 ];
295
296 $fields['wishlist_note'] = $obj->el_heading(
297 esc_html__( 'Wishlist Button', 'shopbuilder' ),
298 'before',
299 [],
300 [ 'show_wishlist' => [ 'yes' ] ]
301 );
302
303 $fields['show_wishlist_text'] = [
304 'type' => 'switch',
305 'label' => esc_html__( 'Show Wishlist Text?', 'shopbuilder' ),
306 'description' => esc_html__( 'Switch on to show wishlist text.', 'shopbuilder' ),
307 'label_on' => esc_html__( 'On', 'shopbuilder' ),
308 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
309 'default' => false,
310 'condition' => [ 'show_wishlist' => [ 'yes' ] ],
311 ];
312 $fields['show_wishlist_icon'] = [
313 'type' => 'switch',
314 'label' => esc_html__( 'Show Wishlist Icon?', 'shopbuilder' ),
315 'description' => esc_html__( 'Switch on to show wishlist icon.', 'shopbuilder' ),
316 'label_on' => esc_html__( 'On', 'shopbuilder' ),
317 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
318 'default' => 'yes',
319 'condition' => [ 'show_wishlist' => [ 'yes' ] ],
320 ];
321 $fields['wishlist_icon'] = [
322 'type' => 'icons',
323 'label' => esc_html__( 'Choose Wishlist Icon', 'shopbuilder' ),
324 'default' => [
325 'value' => 'rtsb-icon rtsb-icon-heart-empty',
326 'library' => 'rtsb-fonts',
327 ],
328 'condition' => [
329 'show_wishlist' => [ 'yes' ],
330 'show_wishlist_icon' => [ 'yes' ],
331 ],
332 ];
333
334 $fields['wishlist_icon_added'] = [
335 'type' => 'icons',
336 'label' => esc_html__( 'Choose Wishlist Success Icon', 'shopbuilder' ),
337 'default' => [
338 'value' => 'rtsb-icon rtsb-icon-heart',
339 'library' => 'rtsb-fonts',
340 ],
341 'condition' => [ 'show_wishlist' => [ 'yes' ] ],
342 ];
343
344 $fields['quick_view_note'] = $obj->el_heading(
345 esc_html__( 'Quick View Button', 'shopbuilder' ),
346 'before',
347 [],
348 [ 'show_quick_view' => [ 'yes' ] ]
349 );
350 $fields['show_quick_view_text'] = [
351 'type' => 'switch',
352 'label' => esc_html__( 'Show Quick View Text?', 'shopbuilder' ),
353 'description' => esc_html__( 'Switch on to show quick view text.', 'shopbuilder' ),
354 'label_on' => esc_html__( 'On', 'shopbuilder' ),
355 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
356 'default' => false,
357 'condition' => [ 'show_quick_view' => [ 'yes' ] ],
358 ];
359 $fields['show_quick_view_icon'] = [
360 'type' => 'switch',
361 'label' => esc_html__( 'Show Quick View Icon?', 'shopbuilder' ),
362 'description' => esc_html__( 'Switch on to show quick view icon.', 'shopbuilder' ),
363 'label_on' => esc_html__( 'On', 'shopbuilder' ),
364 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
365 'default' => 'yes',
366 'condition' => [ 'show_quick_view' => [ 'yes' ] ],
367 ];
368 $fields['quick_view_icon'] = [
369 'type' => 'icons',
370 'label' => esc_html__( 'Choose Quick View Icon', 'shopbuilder' ),
371 'default' => [
372 'value' => 'rtsb-icon rtsb-icon-eye',
373 'library' => 'rtsb-fonts',
374 ],
375 'condition' => [
376 'show_quick_view' => [ 'yes' ],
377 'show_quick_view_icon' => [ 'yes' ],
378 ],
379 ];
380
381 $fields['compare_note'] = $obj->el_heading(
382 esc_html__( 'Compare Button', 'shopbuilder' ),
383 'before',
384 [],
385 [ 'show_compare' => [ 'yes' ] ]
386 );
387 $fields['show_compare_text'] = [
388 'type' => 'switch',
389 'label' => esc_html__( 'Show Compare Text?', 'shopbuilder' ),
390 'description' => esc_html__( 'Switch on to show compare text.', 'shopbuilder' ),
391 'label_on' => esc_html__( 'On', 'shopbuilder' ),
392 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
393 'default' => false,
394 'condition' => [ 'show_compare' => [ 'yes' ] ],
395 ];
396 $fields['show_compare_icon'] = [
397 'type' => 'switch',
398 'label' => esc_html__( 'Show Compare Icon?', 'shopbuilder' ),
399 'description' => esc_html__( 'Switch on to show compare icon.', 'shopbuilder' ),
400 'label_on' => esc_html__( 'On', 'shopbuilder' ),
401 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
402 'default' => 'yes',
403 'condition' => [ 'show_compare' => [ 'yes' ] ],
404 ];
405 $fields['comparison_icon'] = [
406 'type' => 'icons',
407 'label' => esc_html__( 'Choose Compare Icon', 'shopbuilder' ),
408 'default' => [
409 'value' => 'rtsb-icon rtsb-icon-exchange',
410 'library' => 'rtsb-fonts',
411 ],
412 'condition' => [
413 'show_compare' => [ 'yes' ],
414 'show_compare_icon' => [ 'yes' ],
415 ],
416 ];
417
418 $fields['comparison_icon_added'] = [
419 'type' => 'icons',
420 'label' => esc_html__( 'Choose Compare Success Icon', 'shopbuilder' ),
421 'default' => [
422 'value' => 'rtsb-icon rtsb-icon-check',
423 'library' => 'rtsb-fonts',
424 ],
425 'condition' => [ 'show_compare' => [ 'yes' ] ],
426 ];
427
428 $fields['action_visibility_section_end'] = $obj->end_section();
429
430 return apply_filters( 'rtsb/elements/elementor/action_buttons', $fields, $obj );
431 }
432
433 /**
434 * Category Visibility section
435 *
436 * @param object $obj Reference object.
437 *
438 * @return array
439 */
440 public static function cat_content_visibility( $obj ) {
441 $status = ! rtsb()->has_pro();
442 $fields['cat_visibility_section'] = $obj->start_section(
443 esc_html__( 'Content Visibility', 'shopbuilder' ),
444 self::$tab
445 );
446
447 $fields['show_title'] = [
448 'type' => 'switch',
449 'label' => esc_html__( 'Show Category Title?', 'shopbuilder' ),
450 'description' => esc_html__( 'Switch on to show category title.', 'shopbuilder' ),
451 'label_on' => esc_html__( 'On', 'shopbuilder' ),
452 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
453 'default' => 'yes',
454 ];
455
456 $fields['show_short_desc'] = [
457 'type' => 'switch',
458 'label' => esc_html__( 'Show Category Description?', 'shopbuilder' ),
459 'description' => esc_html__( 'Switch on to show category description.', 'shopbuilder' ),
460 'label_on' => esc_html__( 'On', 'shopbuilder' ),
461 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
462 ];
463
464 $fields['show_count'] = [
465 'type' => 'switch',
466 'label' => esc_html__( 'Show Product Count?', 'shopbuilder' ),
467 'description' => esc_html__( 'Switch on to show product count.', 'shopbuilder' ),
468 'label_on' => esc_html__( 'On', 'shopbuilder' ),
469 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
470 'default' => 'yes',
471 ];
472
473 $fields['show_badges'] = [
474 'type' => 'switch',
475 'label' => esc_html__( 'Show Custom Badge?', 'shopbuilder' ),
476 'description' => esc_html__( 'Switch on to show custom category badge.', 'shopbuilder' ),
477 'label_on' => esc_html__( 'On', 'shopbuilder' ),
478 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
479 'default' => 'yes',
480 'condition' => [ 'layout!' => [ 'category-layout1', 'category-layout2' ] ],
481 ];
482
483 if ( 'rtsb-product-categories-general' === $obj->rtsb_base ) {
484 $fields['show_count']['separator'] = rtsb()->has_pro() ? 'default' : 'after';
485
486 $fields['active_cat_slider'] = [
487 'type' => 'switch',
488 'label' => esc_html__( 'Active Category Slider?', 'shopbuilder' ),
489 'description' => esc_html__( 'Switch on to active category slider.', 'shopbuilder' ),
490 'label_on' => esc_html__( 'On', 'shopbuilder' ),
491 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
492 'classes' => $obj->pro_class(),
493 'is_pro' => $status,
494 ];
495 }
496
497 $fields['cat_visibility_section_end'] = $obj->end_section();
498
499 return $fields;
500 }
501
502 /**
503 * Image section
504 *
505 * @param object $obj Reference object.
506 *
507 * @return array
508 */
509 public static function image( $obj ) {
510 $fields['image_section'] = $obj->start_section(
511 esc_html__( 'Product Images', 'shopbuilder' ),
512 'settings'
513 );
514
515 $fields['show_featured_image'] = [
516 'type' => 'switch',
517 'label' => esc_html__( 'Display Featured Image?', 'shopbuilder' ),
518 'description' => esc_html__( 'Switch on to display featured image.', 'shopbuilder' ),
519 'label_on' => esc_html__( 'On', 'shopbuilder' ),
520 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
521 'default' => 'yes',
522 'separator' => rtsb()->has_pro() ? 'default' : 'after',
523 ];
524
525 $fields['show_product_gallery'] = [
526 'type' => 'switch',
527 'label' => esc_html__( 'Activate Product Image Gallery Slider', 'shopbuilder' ),
528 'description' => esc_html__( 'Switch on to display product image gallery slider.', 'shopbuilder' ),
529 'classes' => $obj->pro_class(),
530 'condition' => [
531 'show_featured_image' => [ 'yes' ],
532 'grid_style!' => [ 'masonry' ],
533 ],
534 ];
535
536 $fields['show_product_gallery_thumb'] = [
537 'type' => 'switch',
538 'label' => esc_html__( 'Activate Image Gallery Thumbnail', 'shopbuilder' ),
539 'description' => esc_html__( 'Switch on to display product image gallery thumbnail slider.', 'shopbuilder' ),
540 'classes' => $obj->pro_class(),
541 'condition' => [
542 'show_featured_image' => [ 'yes' ],
543 'show_product_gallery' => [ 'yes' ],
544 'grid_style!' => [ 'masonry' ],
545 ],
546 ];
547
548 $fields['show_hover_image'] = [
549 'type' => 'switch',
550 'label' => esc_html__( 'Display Gallery Image on Hover?', 'shopbuilder' ),
551 'description' => __( 'Switch on to display gallery image on hover. <br /><b>Note: </b>It will display the first gallery image on hover.', 'shopbuilder' ) . ( function_exists( 'rtwpvsp' ) ? esc_html__( ' It will not work if variation swatches are enabled.', 'shopbuilder' ) : '' ),
552 'label_on' => esc_html__( 'On', 'shopbuilder' ),
553 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
554 'separator' => rtsb()->has_pro() ? 'default' : 'before-short',
555 'default' => 'yes',
556 'condition' => rtsb()->has_pro() ? [
557 'show_featured_image' => [ 'yes' ],
558 'show_product_gallery!' => [ 'yes' ],
559 ] : [ 'show_featured_image' => [ 'yes' ] ],
560 ];
561
562 $fields['image_hover_animation'] = [
563 'type' => 'select2',
564 'label' => esc_html__( 'Image Hover Animation', 'shopbuilder' ),
565 'description' => esc_html__( 'Please choose image hover animation.', 'shopbuilder' ),
566 'options' => [
567 'zoom_in' => esc_html__( 'Zoom In', 'shopbuilder' ),
568 'zoom_out' => esc_html__( 'Zoom Out', 'shopbuilder' ),
569 'none' => esc_html__( 'None', 'shopbuilder' ),
570 ],
571 'label_block' => true,
572 'condition' => [ 'show_featured_image' => [ 'yes' ] ],
573 'default' => 'zoom_in',
574 'separator' => rtsb()->has_pro() ? 'default' : 'after',
575 ];
576
577 $fields['gallery_hover_animation'] = [
578 'type' => 'select2',
579 'label' => esc_html__( 'Gallery Image Hover Animation', 'shopbuilder' ),
580 'description' => esc_html__( 'Please choose gallery image hover animation.', 'shopbuilder' ),
581 'options' => [
582 'fade' => esc_html__( 'Default (Fade)', 'shopbuilder' ),
583 'slide' => esc_html__( 'Slide Up', 'shopbuilder' ),
584 'slide-down' => esc_html__( 'Slide Down', 'shopbuilder' ),
585 'slide-left' => esc_html__( 'Slide Left', 'shopbuilder' ),
586 'slide-right' => esc_html__( 'Slide Right', 'shopbuilder' ),
587 ],
588 'label_block' => true,
589 'condition' => rtsb()->has_pro() ? [
590 'show_featured_image' => [ 'yes' ],
591 'show_hover_image' => [ 'yes' ],
592 'show_product_gallery!' => [ 'yes' ],
593 ] : [
594 'show_featured_image' => [ 'yes' ],
595 'show_hover_image' => [ 'yes' ],
596 ],
597 'default' => 'fade',
598 'classes' => $obj->pro_class(),
599 ];
600
601 $fields['image_size_note'] = $obj->el_heading(
602 esc_html__( 'Image Size', 'shopbuilder' ),
603 'before',
604 [],
605 [ 'show_featured_image' => [ 'yes' ] ]
606 );
607
608 $fields = array_merge( $fields, self::image_size_controls( 'grid' ) );
609
610 $fields['thumb_image_note'] = $obj->el_heading(
611 esc_html__( 'Thumbnail Slider', 'shopbuilder' ),
612 'before',
613 [],
614 [
615 'show_featured_image' => [ 'yes' ],
616 'show_product_gallery' => [ 'yes' ],
617 'show_product_gallery_thumb' => [ 'yes' ],
618 'grid_style!' => [ 'masonry' ],
619 ],
620 );
621 $fields['gallery_thumb_column_number'] = [
622 'label' => esc_html__( 'Gallery Thumb Image Column', 'shopbuilder' ),
623 'classes' => $obj->pro_class(),
624 'type' => 'slider',
625 'size_units' => [ 'px' ],
626 'range' => [
627 'px' => [
628 'min' => 2,
629 'max' => 10,
630 'step' => 1,
631 ],
632 ],
633 'default' => [
634 'size' => 3,
635 ],
636 'condition' => [
637 'show_featured_image' => [ 'yes' ],
638 'show_product_gallery' => [ 'yes' ],
639 'show_product_gallery_thumb' => [ 'yes' ],
640 'grid_style!' => [ 'masonry' ],
641 ],
642 ];
643 $fields['gallery_thumb_column_gap'] = [
644 'label' => esc_html__( 'Gallery Thumb Column Gap', 'shopbuilder' ),
645 'classes' => $obj->pro_class(),
646 'type' => 'slider',
647 'size_units' => [ 'px' ],
648 'range' => [
649 'px' => [
650 'min' => 2,
651 'max' => 30,
652 'step' => 1,
653 ],
654 ],
655 'default' => [
656 'size' => 10,
657 ],
658 'condition' => [
659 'show_featured_image' => [ 'yes' ],
660 'show_product_gallery' => [ 'yes' ],
661 'show_product_gallery_thumb' => [ 'yes' ],
662 'grid_style!' => [ 'masonry' ],
663 ],
664 ];
665
666 $fields['thumb_image_section_end'] = $obj->end_section();
667 return $fields;
668 }
669
670 /**
671 * Category Image section
672 *
673 * @param object $obj Reference object.
674 *
675 * @return array
676 */
677 public static function cat_image( $obj ) {
678 $fields['cat_image_section'] = $obj->start_section(
679 esc_html__( 'Image', 'shopbuilder' ),
680 self::$tab
681 );
682
683 $fields['show_cat_image'] = [
684 'type' => 'switch',
685 'label' => esc_html__( 'Display Category Image?', 'shopbuilder' ),
686 'description' => esc_html__( 'Switch on to display category image.', 'shopbuilder' ),
687 'label_on' => esc_html__( 'On', 'shopbuilder' ),
688 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
689 'default' => 'yes',
690 ];
691
692 $fields['show_custom_image'] = [
693 'type' => 'switch',
694 'label' => esc_html__( 'Add Custom Image?', 'shopbuilder' ),
695 'description' => esc_html__( 'Switch on to select a custom category image. Setting a custom image will override the category image.', 'shopbuilder' ),
696 'label_on' => esc_html__( 'On', 'shopbuilder' ),
697 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
698 'classes' => $obj->pro_class(),
699 ];
700
701 $fields['custom_image'] = [
702 'type' => 'media',
703 'label' => esc_html__( 'Upload Custom Image', 'shopbuilder' ),
704 'description' => esc_html__( 'Please choose the custom category image. It will override the default image.', 'shopbuilder' ),
705 'label_on' => esc_html__( 'On', 'shopbuilder' ),
706 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
707 'condition' => [
708 'show_custom_image' => [ 'yes' ],
709 'layout' => [ 'category-single-layout1', 'category-single-layout2' ],
710 ],
711 'default' => [
712 'url' => \Elementor\Utils::get_placeholder_image_src(),
713 ],
714 ];
715
716 $fields['show_overlay'] = [
717 'type' => 'switch',
718 'label' => esc_html__( 'Enable Image Overlay?', 'shopbuilder' ),
719 'description' => esc_html__( 'Switch on to enable image overlay.', 'shopbuilder' ),
720 'label_on' => esc_html__( 'On', 'shopbuilder' ),
721 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
722 'separator' => 'before',
723 'condition' => [
724 'layout' => [ 'category-single-layout1' ],
725 ],
726 ];
727
728 $fields['image_hover_animation'] = [
729 'type' => 'select2',
730 'label' => esc_html__( 'Image Hover Animation', 'shopbuilder' ),
731 'description' => esc_html__( 'Please choose image hover animation.', 'shopbuilder' ),
732 'options' => [
733 'zoom_in' => esc_html__( 'Zoom In', 'shopbuilder' ),
734 'zoom_out' => esc_html__( 'Zoom Out', 'shopbuilder' ),
735 'none' => esc_html__( 'None', 'shopbuilder' ),
736 ],
737 'label_block' => true,
738 'condition' => [
739 'show_cat_image' => [ 'yes' ],
740 'layout!' => [ 'category-layout4' ],
741 ],
742 'default' => 'zoom_in',
743 'separator' => rtsb()->has_pro() ? 'default' : 'before-short',
744 ];
745
746 $fields['cat_image_size_note'] = $obj->el_heading(
747 esc_html__( 'Image Size', 'shopbuilder' ),
748 'before',
749 [],
750 [ 'show_cat_image' => [ 'yes' ] ]
751 );
752
753 $fields = array_merge( $fields, self::image_size_controls( 'catgory' ) );
754
755 $fields['cat_image_section_end'] = $obj->end_section();
756
757 return apply_filters( 'rtsb/elements/elementor/cat_image_control', $fields, $obj );
758 }
759
760 /**
761 * Image Size Controls.
762 *
763 * @param string $type Type.
764 *
765 * @return array
766 */
767 public static function image_size_controls( $type ) {
768 $conditions = [
769 'relation' => 'and',
770 'terms' => [],
771 ];
772
773 if ( 'grid' === $type ) {
774 $conditions['terms'][] = [
775 'relation' => 'or',
776 'terms' => [
777 [
778 'name' => 'show_featured_image',
779 'operator' => '==',
780 'value' => 'yes',
781 ],
782 ],
783 ];
784 } else {
785 $conditions['terms'][] = [
786 'relation' => 'or',
787 'terms' => [
788 [
789 'name' => 'show_cat_image',
790 'operator' => '==',
791 'value' => 'yes',
792 ],
793 [
794 'name' => 'show_custom_image',
795 'operator' => '==',
796 'value' => 'yes',
797 ],
798 ],
799 ];
800 }
801
802 $fields['image'] = [
803 'type' => 'select2',
804 'label' => esc_html__( 'Select Image Size', 'shopbuilder' ),
805 'description' => esc_html__( 'Please select the image size.', 'shopbuilder' ),
806 'options' => Fns::get_image_sizes(),
807 'default' => 'woocommerce_thumbnail',
808 'label_block' => true,
809 'content_classes' => 'elementor-descriptor',
810 'conditions' => $conditions,
811 ];
812
813 $conditions['terms'][] = [
814 'relation' => 'or',
815 'terms' => [
816 [
817 'name' => 'image',
818 'operator' => '==',
819 'value' => 'rtsb_custom',
820 ],
821 ],
822 ];
823
824 $fields['image_custom_dimension'] = [
825 'type' => 'image-dimensions',
826 'label' => esc_html__( 'Enter Custom Image Size', 'shopbuilder' ),
827 'label_block' => true,
828 'show_label' => true,
829 'default' => [
830 'width' => 400,
831 'height' => 400,
832 ],
833 'conditions' => $conditions,
834 ];
835
836 $fields['image_crop'] = [
837 'type' => 'select2',
838 'label' => esc_html__( 'Image Crop', 'shopbuilder' ),
839 'description' => esc_html__( 'Please click on "Apply" to update the image.', 'shopbuilder' ),
840 'options' => [
841 'soft' => esc_html__( 'Soft Crop', 'shopbuilder' ),
842 'hard' => esc_html__( 'Hard Crop', 'shopbuilder' ),
843 ],
844 'default' => 'hard',
845 'conditions' => $conditions,
846 ];
847
848 $fields['image_custom_dimension_note'] = [
849 'type' => 'html',
850 'raw' => sprintf(
851 '<span style="display: block; background: #fffbf1; padding: 10px; font-weight: 500; line-height: 1.4; color: #bd3a3a;border: 1px solid #bd3a3a;">%s</span>',
852 esc_html__( 'Please note that, if you enter image size larger than the actual image itself, the image sizes will fallback to the full image dimension.', 'shopbuilder' )
853 ),
854 'conditions' => $conditions,
855 ];
856
857 return $fields;
858 }
859
860 /**
861 * Slider section
862 *
863 * @param object $obj Reference object.
864 *
865 * @return array
866 */
867 public static function slider_settings( $obj ) {
868 $status = ! rtsb()->has_pro();
869
870 $fields['slider_control_section'] = $obj->start_section(
871 esc_html__( 'Slider Settings', 'shopbuilder' ),
872 self::$tab
873 );
874
875 $fields['slider_control_note'] = $obj->el_heading(
876 esc_html__( 'Controls', 'shopbuilder' ),
877 'default'
878 );
879
880 $fields['slider_nav'] = [
881 'type' => 'switch',
882 'label' => esc_html__( 'Navigation Arrows', 'shopbuilder' ),
883 'label_on' => esc_html__( 'On', 'shopbuilder' ),
884 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
885 'description' => esc_html__( 'Switch on to enable slider navigation arrows.', 'shopbuilder' ),
886 'default' => 'yes',
887 ];
888
889 $fields['slider_nav_position'] = [
890 'type' => 'select2',
891 'label' => esc_html__( 'Navigation Arrows Position', 'shopbuilder' ),
892 'options' => [
893 'top' => esc_html__( 'Top', 'shopbuilder' ),
894 'standard' => esc_html__( 'Middle', 'shopbuilder' ),
895 'bottom' => esc_html__( 'Bottom', 'shopbuilder' ),
896 ],
897 'description' => esc_html__( 'Please select the slider arrows position.', 'shopbuilder' ),
898 'default' => 'standard',
899 'label_block' => true,
900 'separator' => rtsb()->has_pro() ? 'default' : 'after',
901 'condition' => [ 'slider_nav' => [ 'yes' ] ],
902 ];
903
904 $fields['always_show_nav'] = [
905 'type' => 'switch',
906 'label' => esc_html__( 'Always Show Arrows', 'shopbuilder' ),
907 'label_on' => esc_html__( 'On', 'shopbuilder' ),
908 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
909 'description' => esc_html__( 'Switch on to enable always showing navigation arrows.', 'shopbuilder' ),
910 'classes' => $obj->pro_class(),
911 'is_pro' => $status,
912 'condition' => [ 'slider_nav' => [ 'yes' ] ],
913 ];
914
915 if ( rtsb()->has_pro() ) {
916 $fields['always_show_nav']['condition']['slider_nav_position'] = 'standard';
917 }
918
919 $fields['slider_left_arrow_icon'] = [
920 'label' => esc_html__( 'Left Arrow Icon', 'shopbuilder' ),
921 'description' => esc_html__( 'Please choose the slider left arrow icon.', 'shopbuilder' ),
922 'type' => 'icons',
923 'default' => [
924 'value' => 'fas fa-chevron-left',
925 'library' => 'fa-solid',
926 ],
927 'separator' => rtsb()->has_pro() ? 'default' : 'before-short',
928 'condition' => [ 'slider_nav' => 'yes' ],
929 ];
930
931 $fields['slider_right_arrow_icon'] = [
932 'label' => esc_html__( 'Right Arrow Icon', 'shopbuilder' ),
933 'description' => esc_html__( 'Please choose the slider right arrow icon.', 'shopbuilder' ),
934 'type' => 'icons',
935 'default' => [
936 'value' => 'fas fa-chevron-right',
937 'library' => 'fa-solid',
938 ],
939 'condition' => [ 'slider_nav' => 'yes' ],
940 ];
941
942 $fields['slider_pagi'] = [
943 'type' => 'switch',
944 'label' => esc_html__( 'Dot Pagination', 'shopbuilder' ),
945 'label_on' => esc_html__( 'On', 'shopbuilder' ),
946 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
947 'description' => esc_html__( 'Switch on to enable slider dot pagination.', 'shopbuilder' ),
948 'default' => 'yes',
949 ];
950 $fields['slider_dynamic_pagi'] = [
951 'type' => 'switch',
952 'label' => esc_html__( 'Dynamic Pagination', 'shopbuilder' ),
953 'label_on' => esc_html__( 'On', 'shopbuilder' ),
954 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
955 'description' => esc_html__( 'It will keep only few bullets visible at the same time.', 'shopbuilder' ),
956 'condition' => [ 'slider_pagi' => 'yes' ],
957 ];
958 $fields['slider_loop'] = [
959 'type' => 'switch',
960 'label' => esc_html__( 'Infinite Loop', 'shopbuilder' ),
961 'label_on' => esc_html__( 'On', 'shopbuilder' ),
962 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
963 'description' => esc_html__( 'Switch on to enable slider infinite loop.', 'shopbuilder' ),
964 'condition' => [ 'tax_filter!' => [ 'yes' ] ],
965 ];
966
967 $fields['slider_auto_height'] = [
968 'type' => 'switch',
969 'label' => esc_html__( 'Auto Height', 'shopbuilder' ),
970 'label_on' => esc_html__( 'On', 'shopbuilder' ),
971 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
972 'description' => esc_html__( 'Switch on to enable slider dynamic height.', 'shopbuilder' ),
973 ];
974
975 $fields['slider_lazy_load'] = [
976 'type' => 'switch',
977 'label' => esc_html__( 'Image Lazy Load', 'shopbuilder' ),
978 'label_on' => esc_html__( 'On', 'shopbuilder' ),
979 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
980 'description' => esc_html__( 'Switch on to enable slider image lazy load.', 'shopbuilder' ),
981 'condition' => [ 'tax_filter!' => [ 'yes' ] ],
982 ];
983
984 $fields['slide_speed'] = [
985 'type' => 'number',
986 'label' => esc_html__( 'Slide Speed (in ms)', 'shopbuilder' ),
987 'description' => esc_html__( 'Please enter the duration of transition between slides (in ms).', 'shopbuilder' ),
988 'default' => 2000,
989 'separator' => $status ? 'default elementor-control-separator-after' : 'default',
990 ];
991
992 $fields['slider_slide_animation'] = [
993 'type' => 'switch',
994 'label' => esc_html__( 'Enable Slide Effect', 'shopbuilder' ),
995 'label_on' => esc_html__( 'On', 'shopbuilder' ),
996 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
997 'description' => esc_html__( 'Switch on to enable zoom-in effect when sliding.', 'shopbuilder' ),
998 'default' => '',
999 'classes' => $obj->pro_class(),
1000 'is_pro' => $status,
1001 ];
1002
1003 $fields['slider_autoplay_note'] = $obj->el_heading(
1004 esc_html__( 'Autoplay', 'shopbuilder' ),
1005 'before'
1006 );
1007
1008 $fields['slide_autoplay'] = [
1009 'type' => 'switch',
1010 'label' => esc_html__( 'Enable Autoplay?', 'shopbuilder' ),
1011 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1012 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1013 'description' => esc_html__( 'Switch on to enable slider autoplay.', 'shopbuilder' ),
1014 'default' => 'yes',
1015 ];
1016
1017 $fields['pause_hover'] = [
1018 'type' => 'switch',
1019 'label' => esc_html__( 'Pause on Mouse Hover?', 'shopbuilder' ),
1020 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1021 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1022 'description' => esc_html__( 'Switch on to enable slider autoplay pause on mouse hover.', 'shopbuilder' ),
1023 'default' => 'yes',
1024 'condition' => [ 'slide_autoplay' => 'yes' ],
1025 ];
1026
1027 $fields['autoplay_timeout'] = [
1028 'type' => 'number',
1029 'label' => esc_html__( 'Autoplay Delay (in ms)', 'shopbuilder' ),
1030 'default' => 5000,
1031 'description' => esc_html__( 'Please select autoplay interval delay (in ms).', 'shopbuilder' ),
1032 'condition' => [ 'slide_autoplay' => 'yes' ],
1033 ];
1034
1035 $fields['slider_control_section_end'] = $obj->end_section();
1036
1037 return $fields;
1038 }
1039
1040 /**
1041 * Title section
1042 *
1043 * @param object $obj Reference object.
1044 *
1045 * @return array
1046 */
1047 public static function product_title( $obj ) {
1048 $condition = [
1049 'show_title' => [ 'yes' ],
1050 ];
1051
1052 $fields['product_title_section'] = $obj->start_section(
1053 esc_html__( 'Product Title', 'shopbuilder' ),
1054 self::$tab,
1055 [],
1056 $condition
1057 );
1058
1059 $fields['title_tag'] = [
1060 'type' => 'select2',
1061 'label' => esc_html__( 'Product Title Tag', 'shopbuilder' ),
1062 'options' => ControlHelper::heading_tags(),
1063 'label_block' => true,
1064 'default' => 'h3',
1065 'description' => esc_html__( 'Please select the product title tag.', 'shopbuilder' ),
1066 ];
1067
1068 // TODO: Will be activated later.
1069 // $fields['title_hover'] = [
1070 // 'type' => 'switch',
1071 // 'label' => esc_html__( 'Title Hover Underline', 'shopbuilder' ),
1072 // 'default' => 200,
1073 // 'description' => esc_html__( 'Switch on to enable title hover underline.', 'shopbuilder' ),
1074 // 'classes' => $obj->pro_class(),
1075 // ];
1076
1077 $fields['title_limit'] = [
1078 'type' => 'select2',
1079 'label' => esc_html__( 'Product Title Limit', 'shopbuilder' ),
1080 'options' => [
1081 'default' => esc_html__( 'Default', 'shopbuilder' ),
1082 '1-line' => esc_html__( 'Show in 1 line', 'shopbuilder' ),
1083 '2-lines' => esc_html__( 'Show in 2 lines', 'shopbuilder' ),
1084 '3-lines' => esc_html__( 'Show in 3 lines', 'shopbuilder' ),
1085 'custom' => esc_html__( 'Custom', 'shopbuilder' ),
1086 ],
1087 'label_block' => true,
1088 'default' => 'default',
1089 'description' => esc_html__( 'Please select the product title limit.', 'shopbuilder' ),
1090 ];
1091
1092 $fields['title_limit_custom'] = [
1093 'type' => 'number',
1094 'label' => esc_html__( 'Custom Character Limit', 'shopbuilder' ),
1095 'default' => 200,
1096 'description' => esc_html__( 'Please enter the product title character limit.', 'shopbuilder' ),
1097 'condition' => [ 'title_limit' => [ 'custom' ] ],
1098 ];
1099
1100 $fields['product_title_section_end'] = $obj->end_section();
1101
1102 return $fields;
1103 }
1104
1105 /**
1106 * Title section
1107 *
1108 * @param object $obj Reference object.
1109 *
1110 * @return array
1111 */
1112 public static function section_title( $obj ) {
1113 $condition = [
1114 'show_section_title' => [ 'yes' ],
1115 ];
1116
1117 $fields['section_title_section'] = $obj->start_section(
1118 esc_html__( 'Section Title', 'shopbuilder' ),
1119 self::$tab,
1120 [],
1121 $condition
1122 );
1123
1124 $fields['section_title_tag'] = [
1125 'type' => 'select2',
1126 'label' => esc_html__( 'Section Title Tag', 'shopbuilder' ),
1127 'options' => ControlHelper::heading_tags(),
1128 'label_block' => true,
1129 'default' => 'h2',
1130 'description' => esc_html__( 'Please select the section title tag.', 'shopbuilder' ),
1131 ];
1132
1133 $fields['section_title_text'] = [
1134 'type' => 'text',
1135 'label' => esc_html__( 'Section Title Text', 'shopbuilder' ),
1136 'default' => esc_html__( 'Section Title', 'shopbuilder' ),
1137 'description' => esc_html__( 'Please enter the section title text.', 'shopbuilder' ),
1138 'label_block' => true,
1139 ];
1140
1141 $fields['section_title_section_end'] = $obj->end_section();
1142
1143 return $fields;
1144 }
1145
1146 /**
1147 * Category Title section
1148 *
1149 * @param object $obj Reference object.
1150 *
1151 * @return array
1152 */
1153 public static function cat_title( $obj ) {
1154 $condition = [
1155 'show_title' => [ 'yes' ],
1156 ];
1157
1158 $fields['category_title_section'] = $obj->start_section(
1159 esc_html__( 'Category Title', 'shopbuilder' ),
1160 self::$tab,
1161 [],
1162 $condition
1163 );
1164
1165 $fields['title_tag'] = [
1166 'type' => 'select2',
1167 'label' => esc_html__( 'Category Title Tag', 'shopbuilder' ),
1168 'options' => ControlHelper::heading_tags(),
1169 'label_block' => true,
1170 'default' => 'h3',
1171 'description' => esc_html__( 'Please select the category title tag.', 'shopbuilder' ),
1172 'separator' => rtsb()->has_pro() ? 'before-short' : 'default',
1173 ];
1174
1175 $fields['show_custom_title'] = [
1176 'type' => 'switch',
1177 'label' => esc_html__( 'Enable Custom Title?', 'shopbuilder' ),
1178 'description' => esc_html__( 'Switch on to display alternate custom title.', 'shopbuilder' ),
1179 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1180 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1181 'classes' => $obj->pro_class(),
1182 'separator' => rtsb()->has_pro() ? 'before-short' : 'default',
1183 'condition' => [ 'layout' => [ 'category-single-layout1' ] ],
1184 ];
1185
1186 $fields['custom_title'] = [
1187 'type' => 'textarea',
1188 'label' => esc_html__( 'Alternate Custom Title', 'shopbuilder' ),
1189 'description' => esc_html__( 'Please enter an alternate custom title.', 'shopbuilder' ),
1190 'condition' => [
1191 'show_custom_title' => [ 'yes' ],
1192 'layout' => [ 'category-single-layout1' ],
1193 ],
1194 'classes' => $obj->pro_class(),
1195 'separator' => rtsb()->has_pro() ? 'before-short' : 'default',
1196 ];
1197
1198 $fields['title_limit'] = [
1199 'type' => 'select2',
1200 'label' => esc_html__( 'Category Title Limit', 'shopbuilder' ),
1201 'options' => [
1202 'default' => esc_html__( 'Default', 'shopbuilder' ),
1203 '1-line' => esc_html__( 'Show in 1 line', 'shopbuilder' ),
1204 '2-lines' => esc_html__( 'Show in 2 lines', 'shopbuilder' ),
1205 '3-lines' => esc_html__( 'Show in 3 lines', 'shopbuilder' ),
1206 'custom' => esc_html__( 'Custom', 'shopbuilder' ),
1207 ],
1208 'label_block' => true,
1209 'default' => 'default',
1210 'separator' => rtsb()->has_pro() ? 'default' : 'before',
1211 'description' => esc_html__( 'Please select the category title limit.', 'shopbuilder' ),
1212 ];
1213
1214 $fields['title_limit_custom'] = [
1215 'type' => 'number',
1216 'label' => esc_html__( 'Custom Character Limit', 'shopbuilder' ),
1217 'default' => 200,
1218 'description' => esc_html__( 'Please select the category title custom limit.', 'shopbuilder' ),
1219 'condition' => [ 'title_limit' => [ 'custom' ] ],
1220 ];
1221
1222 $fields['category_title_section_end'] = $obj->end_section();
1223
1224 return $fields;
1225 }
1226
1227 /**
1228 * Excerpt section
1229 *
1230 * @param object $obj Reference object.
1231 *
1232 * @return array
1233 */
1234 public static function product_excerpt( $obj ) {
1235 $condition = [
1236 'show_short_desc' => [ 'yes' ],
1237 ];
1238
1239 $fields['product_excerpt_section'] = $obj->start_section(
1240 esc_html__( 'Short Description', 'shopbuilder' ),
1241 self::$tab,
1242 [],
1243 $condition
1244 );
1245
1246 $fields['excerpt_limit'] = [
1247 'type' => 'select2',
1248 'label' => esc_html__( 'Short Description Limit', 'shopbuilder' ),
1249 'description' => esc_html__( 'Please select the product short description limit.', 'shopbuilder' ),
1250 'options' => [
1251 'default' => esc_html__( 'Default', 'shopbuilder' ),
1252 '1-line' => esc_html__( 'Show in 1 line', 'shopbuilder' ),
1253 '2-lines' => esc_html__( 'Show in 2 lines', 'shopbuilder' ),
1254 '3-lines' => esc_html__( 'Show in 3 lines', 'shopbuilder' ),
1255 'custom' => esc_html__( 'Custom', 'shopbuilder' ),
1256 ],
1257 'label_block' => true,
1258 'default' => 'default',
1259 ];
1260
1261 $fields['excerpt_limit_custom'] = [
1262 'type' => 'number',
1263 'label' => esc_html__( 'Custom Character Limit', 'shopbuilder' ),
1264 'default' => 200,
1265 'description' => esc_html__( 'Please enter the product short description character limit.', 'shopbuilder' ),
1266 'condition' => [ 'excerpt_limit' => [ 'custom' ] ],
1267 ];
1268
1269 $fields['product_excerpt_section_end'] = $obj->end_section();
1270
1271 return $fields;
1272 }
1273
1274 /**
1275 * Category Excerpt section
1276 *
1277 * @param object $obj Reference object.
1278 *
1279 * @return array
1280 */
1281 public static function cat_excerpt( $obj ) {
1282 $condition = [
1283 'show_short_desc' => [ 'yes' ],
1284 ];
1285
1286 $fields['cat_excerpt_section'] = $obj->start_section(
1287 esc_html__( 'Category Description', 'shopbuilder' ),
1288 self::$tab,
1289 [],
1290 $condition
1291 );
1292
1293 $fields['desciption_note'] = [
1294 'type' => 'html',
1295 'raw' => '',
1296 'content_classes' => 'elementor-panel-heading-title',
1297 'condition' => [ 'layout' => [ 'category-single-layout1' ] ],
1298 ];
1299
1300 $fields['show_custom_description'] = [
1301 'type' => 'switch',
1302 'label' => esc_html__( 'Enable Custom Description?', 'shopbuilder' ),
1303 'description' => esc_html__( 'Switch on to display alternate custom description.', 'shopbuilder' ),
1304 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1305 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1306 'classes' => $obj->pro_class(),
1307 'separator' => rtsb()->has_pro() ? 'before-short' : $obj->pro_class(),
1308 'condition' => [ 'layout' => [ 'category-single-layout1' ] ],
1309 ];
1310
1311 $fields['custom_description'] = [
1312 'type' => 'textarea',
1313 'label' => esc_html__( 'Alternate Custom Description', 'shopbuilder' ),
1314 'description' => esc_html__( 'Please enter an alternate custom description.', 'shopbuilder' ),
1315 'condition' => [
1316 'show_custom_description' => [ 'yes' ],
1317 'layout' => [ 'category-single-layout1' ],
1318 ],
1319 'classes' => $obj->pro_class(),
1320 'separator' => rtsb()->has_pro() ? 'before-short' : 'default',
1321 ];
1322
1323 $fields['excerpt_position'] = [
1324 'type' => 'select2',
1325 'label' => esc_html__( 'Category Description Position', 'shopbuilder' ),
1326 'description' => esc_html__( 'Please select the category short description position.', 'shopbuilder' ),
1327 'options' => [
1328 'above' => esc_html__( 'Top', 'shopbuilder' ),
1329 'below' => esc_html__( 'Bottom', 'shopbuilder' ),
1330 ],
1331 'label_block' => true,
1332 'condition' => [ 'layout!' => [ 'category-layout2' ] ],
1333 'default' => 'below',
1334 ];
1335
1336 $fields['excerpt_limit'] = [
1337 'type' => 'select2',
1338 'label' => esc_html__( 'Category Description Limit', 'shopbuilder' ),
1339 'description' => esc_html__( 'Please select the category short description limit.', 'shopbuilder' ),
1340 'options' => [
1341 'default' => esc_html__( 'Default', 'shopbuilder' ),
1342 '1-line' => esc_html__( 'Show in 1 line', 'shopbuilder' ),
1343 '2-lines' => esc_html__( 'Show in 2 lines', 'shopbuilder' ),
1344 '3-lines' => esc_html__( 'Show in 3 lines', 'shopbuilder' ),
1345 'custom' => esc_html__( 'Custom', 'shopbuilder' ),
1346 ],
1347 'label_block' => true,
1348 'default' => 'default',
1349 ];
1350
1351 $fields['excerpt_limit_custom'] = [
1352 'type' => 'number',
1353 'label' => esc_html__( 'Custom Character Limit', 'shopbuilder' ),
1354 'default' => 200,
1355 'description' => esc_html__( 'Please select the category short description custom limit.', 'shopbuilder' ),
1356 'condition' => [ 'excerpt_limit' => [ 'custom' ] ],
1357 ];
1358
1359 $fields['cat_excerpt_section_end'] = $obj->end_section();
1360
1361 return $fields;
1362 }
1363
1364 /**
1365 * Variation swatch section
1366 *
1367 * @param object $obj Reference object.
1368 *
1369 * @return array
1370 */
1371 public static function variation_swatch( $obj ) {
1372 if ( ! function_exists( 'rtwpvsp' ) ) {
1373 return [];
1374 }
1375
1376 $condition = [
1377 'show_swatches' => [ 'yes' ],
1378 ];
1379
1380 $fields['variation_swatch_section'] = $obj->start_section(
1381 esc_html__( 'Variation Swatches', 'shopbuilder' ),
1382 self::$tab,
1383 [],
1384 $condition
1385 );
1386
1387 $fields['swatch_position'] = [
1388 'type' => 'select2',
1389 'label' => esc_html__( 'Swatches Display Position', 'shopbuilder' ),
1390 'description' => esc_html__( 'Please select the variation swatches display position.', 'shopbuilder' ),
1391 'options' => [
1392 'top' => esc_html__( 'Top of Content', 'shopbuilder' ),
1393 'title' => esc_html__( 'With Product Title', 'shopbuilder' ),
1394 'price' => esc_html__( 'WIth Product Price', 'shopbuilder' ),
1395 ],
1396 'label_block' => true,
1397 'default' => 'top',
1398 ];
1399
1400 $fields['swatch_type'] = [
1401 'type' => 'select2',
1402 'label' => esc_html__( 'Color Swatches Type', 'shopbuilder' ),
1403 'description' => esc_html__( 'Please select the variation swatches display type (only work with color swatch).', 'shopbuilder' ),
1404 'options' => [
1405 'square' => esc_html__( 'Square', 'shopbuilder' ),
1406 'circle' => esc_html__( 'Circle', 'shopbuilder' ),
1407 ],
1408 'label_block' => true,
1409 'default' => 'circle',
1410 ];
1411
1412 $fields['swatch_margin'] = [
1413 'mode' => 'responsive',
1414 'type' => 'dimensions',
1415 'label' => esc_html__( 'Margin', 'shopbuilder' ),
1416 'size_units' => [ 'px', '%', 'em' ],
1417 'selectors' => [ '{{WRAPPER}} .rtsb-swatches' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
1418 ];
1419
1420 $fields['variation_swatch_section_end'] = $obj->end_section();
1421
1422 return $fields;
1423 }
1424
1425 /**
1426 * Badge section
1427 *
1428 * @param object $obj Reference object.
1429 *
1430 * @return array
1431 */
1432 public static function badges( $obj ) {
1433 $condition = [
1434 'show_badges' => [ 'yes' ],
1435 'layout!' => [ 'category-layout1', 'category-layout2' ],
1436 ];
1437
1438 $fields['badges_section'] = $obj->start_section(
1439 esc_html__( 'Badges', 'shopbuilder' ),
1440 self::$tab,
1441 [],
1442 $condition
1443 );
1444 $fields['enable_badges_module'] = [
1445 'type' => 'switch',
1446 'label' => esc_html__( 'Enable Badges Module?', 'shopbuilder' ),
1447 'description' => esc_html__( 'Switch on to integrate Badge module.', 'shopbuilder' ),
1448 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1449 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1450 'condition' => [ 'layout!' => [ 'category-single-layout1', 'category-single-layout2', 'category-layout1', 'category-layout2', 'category-layout3' ] ],
1451 ];
1452 $fields['badges_module_notice'] = [
1453 'type' => 'html',
1454 'raw' => sprintf(
1455 '<span style="display: block; background: #fffbf1; padding: 10px; line-height: 1.4; color: #bd3a3a; border: 1px solid #bd3a3a30;">%s</span>',
1456 sprintf(
1457 /* translators: 1: link to the Modules page */
1458 __(
1459 '<b>Note:</b> Badges Module needs to be enabled in the <a href="%1$s" target="_blank">ShopBuilder Modules Settings</a>. From there you can create and customize different badges.',
1460 'shopbuilder'
1461 ),
1462 esc_url( admin_url( 'admin.php?page=rtsb-settings' ) )
1463 )
1464 ),
1465 'separator' => rtsb()->has_pro() ? 'default' : 'after',
1466 'condition' => [ 'enable_badges_module' => [ 'yes' ] ],
1467 ];
1468
1469 $fields['badges_module_direction'] = [
1470 'type' => 'select',
1471 'options' => [
1472 'row' => esc_html__( 'Horizontal', 'shopbuilder' ),
1473 'column' => esc_html__( 'Vertical', 'shopbuilder' ),
1474 ],
1475 'label' => esc_html__( 'Group Badge Direction', 'shopbuilder' ),
1476 'description' => esc_html__( 'Please choose the group badge direction.', 'shopbuilder' ),
1477 'condition' => [ 'enable_badges_module' => [ 'yes' ] ],
1478 'default' => 'row',
1479 'label_block' => true,
1480 'classes' => $obj->pro_class(),
1481 'separator' => rtsb()->has_pro() ? 'before-short' : 'default',
1482 'selectors' => [
1483 $obj->selectors['badges_module']['direction'] => 'flex-direction: {{VALUE}} !important;',
1484 ],
1485 ];
1486
1487 $fields['badges_module_alignment'] = [
1488 'type' => 'choose',
1489 'options' => [
1490 'start' => [
1491 'title' => esc_html__( 'Left', 'shopbuilder' ),
1492 'icon' => 'eicon-text-align-left',
1493 ],
1494 'center' => [
1495 'title' => esc_html__( 'Center', 'shopbuilder' ),
1496 'icon' => 'eicon-text-align-center',
1497 ],
1498 'end' => [
1499 'title' => esc_html__( 'Right', 'shopbuilder' ),
1500 'icon' => 'eicon-text-align-right',
1501 ],
1502 ],
1503 'label' => esc_html__( 'Group Badge Alignment', 'shopbuilder' ),
1504 'description' => esc_html__( 'Please choose the group badge alignment.', 'shopbuilder' ),
1505 'condition' => [ 'enable_badges_module' => [ 'yes' ] ],
1506 'default' => 'start',
1507 'separator' => rtsb()->has_pro() ? 'default' : 'before',
1508 'label_block' => true,
1509 'selectors' => [
1510 $obj->selectors['badges_module']['alignment'] => 'align-items: {{VALUE}} !important;',
1511 ],
1512 ];
1513
1514 $fields['custom_badge_preset'] = [
1515 'type' => 'rtsb-image-selector',
1516 'label' => esc_html__( 'Custom Badge Appearance', 'shopbuilder' ),
1517 'options' => ControlHelper::badge_presets(),
1518 'default' => 'preset1',
1519 'condition' => [ 'enable_badges_module!' => [ 'yes' ] ],
1520 ];
1521
1522 $fields['sale_badges_type'] = [
1523 'type' => 'select2',
1524 'label' => esc_html__( 'Sale Badge Type', 'shopbuilder' ),
1525 'description' => esc_html__( 'Please select the badge type.', 'shopbuilder' ),
1526 'options' => [
1527 'percentage' => esc_html__( 'Show Sale Percentage', 'shopbuilder' ),
1528 'text' => esc_html__( 'Show Sale Text', 'shopbuilder' ),
1529 ],
1530 'default' => 'percentage',
1531 'label_block' => true,
1532 'condition' => [
1533 'layout!' => [ 'category-single-layout1', 'category-single-layout2', 'category-layout1', 'category-layout2', 'category-layout3' ],
1534 'enable_badges_module!' => [ 'yes' ],
1535 ],
1536 ];
1537
1538 $fields['sale_badges_text'] = [
1539 'type' => 'text',
1540 'label' => esc_html__( 'Sale Badge Text', 'shopbuilder' ),
1541 'default' => esc_html__( 'Sale', 'shopbuilder' ),
1542 'description' => esc_html__( 'Please enter the sale badge text.', 'shopbuilder' ),
1543 'label_block' => true,
1544 'condition' => [
1545 'sale_badges_type' => [ 'text' ],
1546 'layout!' => [ 'category-single-layout1', 'category-single-layout2', 'category-layout1', 'category-layout2', 'category-layout3' ],
1547 'enable_badges_module!' => [ 'yes' ],
1548 ],
1549 ];
1550
1551 $fields['stock_badges_text'] = [
1552 'type' => 'text',
1553 'label' => esc_html__( 'Out of Stock Badge Text', 'shopbuilder' ),
1554 'default' => esc_html__( 'Out of Stock', 'shopbuilder' ),
1555 'description' => esc_html__( 'Please enter the out of stock badge text.', 'shopbuilder' ),
1556 'label_block' => true,
1557 'condition' => [
1558 'layout!' => [ 'category-single-layout1', 'category-single-layout2', 'category-layout1', 'category-layout2', 'category-layout3' ],
1559 'enable_badges_module!' => [ 'yes' ],
1560 ],
1561 ];
1562
1563 $fields['custom_badge_text'] = [
1564 'type' => 'text',
1565 'label' => esc_html__( 'Custom Badge Text', 'shopbuilder' ),
1566 'description' => esc_html__( 'Please enter the custom badge text.', 'shopbuilder' ),
1567 'label_block' => true,
1568 'default' => esc_html__( 'Popular', 'shopbuilder' ),
1569 'condition' => [
1570 'layout' => [ 'category-single-layout1', 'category-single-layout2', 'category-layout1', 'category-layout2' ],
1571 'enable_badges_module!' => [ 'yes' ],
1572 ],
1573 ];
1574
1575 $fields['badges_section_end'] = $obj->end_section();
1576
1577 return apply_filters( 'rtsb/elementor/badges', $fields, $obj );
1578 }
1579
1580 /**
1581 * Count section
1582 *
1583 * @param object $obj Reference object.
1584 *
1585 * @return array
1586 */
1587 public static function cat_count_settings( $obj ) {
1588 $condition = [
1589 'show_count' => [ 'yes' ],
1590 ];
1591
1592 $fields['count_section'] = $obj->start_section(
1593 esc_html__( 'Product Count', 'shopbuilder' ),
1594 self::$tab,
1595 [],
1596 $condition
1597 );
1598
1599 $fields['count_display_type'] = [
1600 'type' => 'select2',
1601 'label' => esc_html__( 'Display Position', 'shopbuilder' ),
1602 'description' => esc_html__( 'Please choose the count display position.', 'shopbuilder' ),
1603 'options' => [
1604 'flex' => esc_html__( 'Same Line with Title', 'shopbuilder' ),
1605 'block' => esc_html__( 'After Title', 'shopbuilder' ),
1606 ],
1607 'label_block' => true,
1608 'default' => 'block',
1609 'render_type' => 'template',
1610 'condition' => [ 'layout!' => [ 'category-layout2' ] ],
1611 'selectors' => [
1612 $obj->selectors['cat_count_settings']['count_display_type'] => 'display: {{VALUE}};',
1613 ],
1614 ];
1615
1616 $fields['before_count'] = [
1617 'type' => 'text',
1618 'label' => esc_html__( 'Text Before Count', 'shopbuilder' ),
1619 'description' => esc_html__( 'Please enter the text to show before count.', 'shopbuilder' ),
1620 ];
1621
1622 $fields['after_count'] = [
1623 'type' => 'text',
1624 'label' => esc_html__( 'Text After Count', 'shopbuilder' ),
1625 'description' => esc_html__( 'Please enter the text to show after count.', 'shopbuilder' ),
1626 'default' => esc_html__( ' Products', 'shopbuilder' ),
1627 ];
1628
1629 $fields['count_section_end'] = $obj->end_section();
1630
1631 return $fields;
1632 }
1633
1634 /**
1635 * Pagination section
1636 *
1637 * @param object $obj Reference object.
1638 *
1639 * @return array
1640 */
1641 public static function links( $obj ) {
1642 $fields['links_section'] = $obj->start_section(
1643 esc_html__( 'Links', 'shopbuilder' ),
1644 self::$tab
1645 );
1646 $obj->start_section( 'links_section', esc_html__( 'Detail Page', 'shopbuilder' ), self::$tab );
1647
1648 $fields['title_link'] = [
1649 'type' => 'switch',
1650 'label' => esc_html__( 'Title Clickable?', 'shopbuilder' ),
1651 'description' => esc_html__( 'Switch on to enable title linking.', 'shopbuilder' ),
1652 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1653 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1654 'default' => 'yes',
1655 ];
1656
1657 $fields['image_link'] = [
1658 'type' => 'switch',
1659 'label' => esc_html__( 'Image Clickable?', 'shopbuilder' ),
1660 'description' => esc_html__( 'Switch on to enable image linking.', 'shopbuilder' ),
1661 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1662 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1663 'default' => 'yes',
1664 ];
1665
1666 $fields['hover_btn_note'] = $obj->el_heading(
1667 esc_html__( 'Hover Button', 'shopbuilder' ),
1668 'before',
1669 [],
1670 [ 'layout' => [ 'grid-layout2', 'slider-layout2' ] ]
1671 );
1672
1673 $fields['hover_btn_text'] = [
1674 'type' => 'text',
1675 'label' => esc_html__( 'Hover Button Text', 'shopbuilder' ),
1676 'description' => esc_html__( 'Please enter the button text.', 'shopbuilder' ),
1677 'default' => esc_html__( 'See Details', 'shopbuilder' ),
1678 'condition' => [ 'layout' => [ 'grid-layout2', 'slider-layout2' ] ],
1679 ];
1680
1681 $fields['show_hover_btn_icon'] = [
1682 'type' => 'switch',
1683 'label' => esc_html__( 'Enable Hover Button Icon?', 'shopbuilder' ),
1684 'description' => esc_html__( 'Switch on to enable hover button icon.', 'shopbuilder' ),
1685 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1686 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1687 'default' => 'yes',
1688 'condition' => [ 'layout' => [ 'grid-layout2', 'slider-layout2' ] ],
1689 ];
1690
1691 $fields['hover_btn_icon'] = [
1692 'type' => 'icons',
1693 'label' => esc_html__( 'Choose Icon', 'shopbuilder' ),
1694 'description' => esc_html__( 'Please choose the hover button icon.', 'shopbuilder' ),
1695 'default' => [
1696 'value' => 'fas fa-angle-right',
1697 'library' => 'fa-solid',
1698 ],
1699 'condition' => [
1700 'show_hover_btn_icon' => [ 'yes' ],
1701 'layout' => [ 'grid-layout2', 'slider-layout2' ],
1702 ],
1703 ];
1704
1705 $fields['custom_link'] = [
1706 'type' => 'link',
1707 'label' => esc_html__( 'Alternate Custom Link', 'shopbuilder' ),
1708 'description' => esc_html__( 'Please enter an alternate custom link.', 'shopbuilder' ),
1709 'placeholder' => esc_html__( 'https://custom-link.com', 'shopbuilder' ),
1710 'options' => [ 'url', 'is_external', 'nofollow' ],
1711 'condition' => [ 'layout' => [ 'category-single-layout1' ] ],
1712 ];
1713
1714 $fields['links_section_end'] = $obj->end_section();
1715
1716 return $fields;
1717 }
1718 }
1719