PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.1.12
ShopBuilder – WooCommerce Builder For Elementor v2.1.12
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.1.12, at app/Elementor/Widgets/Controls/SettingsFields.php

1,566 lines 52.4 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' => [ 'show_featured_image' => [ 'yes' ] ],
531 ];
532
533 $fields['show_hover_image'] = [
534 'type' => 'switch',
535 'label' => esc_html__( 'Display Gallery Image on Hover?', 'shopbuilder' ),
536 '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' ) : '' ),
537 'label_on' => esc_html__( 'On', 'shopbuilder' ),
538 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
539 'separator' => rtsb()->has_pro() ? 'default' : 'before-short',
540 'default' => 'yes',
541 'condition' => rtsb()->has_pro() ? [
542 'show_featured_image' => [ 'yes' ],
543 'show_product_gallery!' => [ 'yes' ],
544 ] : [ 'show_featured_image' => [ 'yes' ] ],
545 ];
546
547 $fields['image_hover_animation'] = [
548 'type' => 'select2',
549 'label' => esc_html__( 'Image Hover Animation', 'shopbuilder' ),
550 'description' => esc_html__( 'Please choose image hover animation.', 'shopbuilder' ),
551 'options' => [
552 'zoom_in' => esc_html__( 'Zoom In', 'shopbuilder' ),
553 'zoom_out' => esc_html__( 'Zoom Out', 'shopbuilder' ),
554 'none' => esc_html__( 'None', 'shopbuilder' ),
555 ],
556 'label_block' => true,
557 'condition' => [ 'show_featured_image' => [ 'yes' ] ],
558 'default' => 'zoom_in',
559 'separator' => rtsb()->has_pro() ? 'default' : 'after',
560 ];
561
562 $fields['gallery_hover_animation'] = [
563 'type' => 'select2',
564 'label' => esc_html__( 'Gallery Image Hover Animation', 'shopbuilder' ),
565 'description' => esc_html__( 'Please choose gallery image hover animation.', 'shopbuilder' ),
566 'options' => [
567 'fade' => esc_html__( 'Fade', 'shopbuilder' ),
568 'slide' => esc_html__( 'Slide Up', 'shopbuilder' ),
569 'slide-down' => esc_html__( 'Slide Down', 'shopbuilder' ),
570 'slide-left' => esc_html__( 'Slide Left', 'shopbuilder' ),
571 'slide-right' => esc_html__( 'Slide Right', 'shopbuilder' ),
572 ],
573 'label_block' => true,
574 'condition' => rtsb()->has_pro() ? [
575 'show_featured_image' => [ 'yes' ],
576 'show_hover_image' => [ 'yes' ],
577 'show_product_gallery!' => [ 'yes' ],
578 ] : [
579 'show_featured_image' => [ 'yes' ],
580 'show_hover_image' => [ 'yes' ],
581 ],
582 'default' => 'fade',
583 'classes' => $obj->pro_class(),
584 ];
585
586 $fields['image_size_note'] = $obj->el_heading(
587 esc_html__( 'Image Size', 'shopbuilder' ),
588 'before',
589 [],
590 [ 'show_featured_image' => [ 'yes' ] ]
591 );
592
593 $fields = array_merge( $fields, self::image_size_controls( 'grid' ) );
594
595 $fields['image_section_end'] = $obj->end_section();
596
597 return $fields;
598 }
599
600 /**
601 * Category Image section
602 *
603 * @param object $obj Reference object.
604 *
605 * @return array
606 */
607 public static function cat_image( $obj ) {
608 $fields['cat_image_section'] = $obj->start_section(
609 esc_html__( 'Image', 'shopbuilder' ),
610 self::$tab
611 );
612
613 $fields['show_cat_image'] = [
614 'type' => 'switch',
615 'label' => esc_html__( 'Display Category Image?', 'shopbuilder' ),
616 'description' => esc_html__( 'Switch on to display category image.', 'shopbuilder' ),
617 'label_on' => esc_html__( 'On', 'shopbuilder' ),
618 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
619 'default' => 'yes',
620 ];
621
622 $fields['show_custom_image'] = [
623 'type' => 'switch',
624 'label' => esc_html__( 'Add Custom Image?', 'shopbuilder' ),
625 'description' => esc_html__( 'Switch on to select a custom category image. Setting a custom image will override the category image.', 'shopbuilder' ),
626 'label_on' => esc_html__( 'On', 'shopbuilder' ),
627 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
628 'classes' => $obj->pro_class(),
629 ];
630
631 $fields['custom_image'] = [
632 'type' => 'media',
633 'label' => esc_html__( 'Upload Custom Image', 'shopbuilder' ),
634 'description' => esc_html__( 'Please choose the custom category image. It will override the default image.', 'shopbuilder' ),
635 'label_on' => esc_html__( 'On', 'shopbuilder' ),
636 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
637 'condition' => [
638 'show_custom_image' => [ 'yes' ],
639 'layout' => [ 'category-single-layout1', 'category-single-layout2' ],
640 ],
641 'default' => [
642 'url' => \Elementor\Utils::get_placeholder_image_src(),
643 ],
644 ];
645
646 $fields['show_overlay'] = [
647 'type' => 'switch',
648 'label' => esc_html__( 'Enable Image Overlay?', 'shopbuilder' ),
649 'description' => esc_html__( 'Switch on to enable image overlay.', 'shopbuilder' ),
650 'label_on' => esc_html__( 'On', 'shopbuilder' ),
651 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
652 'separator' => rtsb()->has_pro() ? 'default' : 'before',
653 'condition' => [
654 'layout' => [ 'category-single-layout1' ],
655 ],
656 ];
657
658 $fields['image_hover_animation'] = [
659 'type' => 'select2',
660 'label' => esc_html__( 'Image Hover Animation', 'shopbuilder' ),
661 'description' => esc_html__( 'Please choose image hover animation.', 'shopbuilder' ),
662 'options' => [
663 'zoom_in' => esc_html__( 'Zoom In', 'shopbuilder' ),
664 'zoom_out' => esc_html__( 'Zoom Out', 'shopbuilder' ),
665 'none' => esc_html__( 'None', 'shopbuilder' ),
666 ],
667 'label_block' => true,
668 'condition' => [ 'show_cat_image' => [ 'yes' ] ],
669 'default' => 'zoom_in',
670 'separator' => rtsb()->has_pro() ? 'default' : 'before-short',
671 ];
672
673 $fields['cat_image_size_note'] = $obj->el_heading(
674 esc_html__( 'Image Size', 'shopbuilder' ),
675 'before',
676 [],
677 [ 'show_cat_image' => [ 'yes' ] ]
678 );
679
680 $fields = array_merge( $fields, self::image_size_controls( 'catgory' ) );
681
682 $fields['cat_image_section_end'] = $obj->end_section();
683
684 return apply_filters( 'rtsb/elements/elementor/cat_image_control', $fields, $obj );
685 }
686
687 /**
688 * Image Size Controls.
689 *
690 * @param string $type Type.
691 *
692 * @return array
693 */
694 public static function image_size_controls( $type ) {
695 $conditions = [
696 'relation' => 'and',
697 'terms' => [],
698 ];
699
700 if ( 'grid' === $type ) {
701 $conditions['terms'][] = [
702 'relation' => 'or',
703 'terms' => [
704 [
705 'name' => 'show_featured_image',
706 'operator' => '==',
707 'value' => 'yes',
708 ],
709 ],
710 ];
711 } else {
712 $conditions['terms'][] = [
713 'relation' => 'or',
714 'terms' => [
715 [
716 'name' => 'show_cat_image',
717 'operator' => '==',
718 'value' => 'yes',
719 ],
720 [
721 'name' => 'show_custom_image',
722 'operator' => '==',
723 'value' => 'yes',
724 ],
725 ],
726 ];
727 }
728
729 $fields['image'] = [
730 'type' => 'select2',
731 'label' => esc_html__( 'Select Image Size', 'shopbuilder' ),
732 'description' => esc_html__( 'Please select the image size.', 'shopbuilder' ),
733 'options' => Fns::get_image_sizes(),
734 'default' => 'woocommerce_thumbnail',
735 'label_block' => true,
736 'content_classes' => 'elementor-descriptor',
737 'conditions' => $conditions,
738 ];
739
740 $conditions['terms'][] = [
741 'relation' => 'or',
742 'terms' => [
743 [
744 'name' => 'image',
745 'operator' => '==',
746 'value' => 'rtsb_custom',
747 ],
748 ],
749 ];
750
751 $fields['image_custom_dimension'] = [
752 'type' => 'image-dimensions',
753 'label' => esc_html__( 'Enter Custom Image Size', 'shopbuilder' ),
754 'label_block' => true,
755 'show_label' => true,
756 'default' => [
757 'width' => 400,
758 'height' => 400,
759 ],
760 'conditions' => $conditions,
761 ];
762
763 $fields['image_crop'] = [
764 'type' => 'select2',
765 'label' => esc_html__( 'Image Crop', 'shopbuilder' ),
766 'description' => esc_html__( 'Please click on "Apply" to update the image.', 'shopbuilder' ),
767 'options' => [
768 'soft' => esc_html__( 'Soft Crop', 'shopbuilder' ),
769 'hard' => esc_html__( 'Hard Crop', 'shopbuilder' ),
770 ],
771 'default' => 'hard',
772 'conditions' => $conditions,
773 ];
774
775 $fields['image_custom_dimension_note'] = [
776 'type' => 'html',
777 'raw' => sprintf(
778 '<span style="display: block; background: #fffbf1; padding: 10px; font-weight: 500; line-height: 1.4; color: #bd3a3a;border: 1px solid #bd3a3a;">%s</span>',
779 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' )
780 ),
781 'conditions' => $conditions,
782 ];
783
784 return $fields;
785 }
786
787 /**
788 * Slider section
789 *
790 * @param object $obj Reference object.
791 *
792 * @return array
793 */
794 public static function slider_settings( $obj ) {
795 $status = ! rtsb()->has_pro();
796
797 $fields['slider_control_section'] = $obj->start_section(
798 esc_html__( 'Slider Settings', 'shopbuilder' ),
799 self::$tab
800 );
801
802 $fields['slider_control_note'] = $obj->el_heading(
803 esc_html__( 'Controls', 'shopbuilder' ),
804 'default'
805 );
806
807 $fields['slider_nav'] = [
808 'type' => 'switch',
809 'label' => esc_html__( 'Navigation Arrows', 'shopbuilder' ),
810 'label_on' => esc_html__( 'On', 'shopbuilder' ),
811 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
812 'description' => esc_html__( 'Switch on to enable slider navigation arrows.', 'shopbuilder' ),
813 'default' => 'yes',
814 ];
815
816 $fields['slider_nav_position'] = [
817 'type' => 'select2',
818 'label' => esc_html__( 'Navigation Arrows Position', 'shopbuilder' ),
819 'options' => [
820 'top' => esc_html__( 'Top', 'shopbuilder' ),
821 'standard' => esc_html__( 'Middle', 'shopbuilder' ),
822 'bottom' => esc_html__( 'Bottom', 'shopbuilder' ),
823 ],
824 'description' => esc_html__( 'Please select the slider arrows position.', 'shopbuilder' ),
825 'default' => 'standard',
826 'label_block' => true,
827 'separator' => rtsb()->has_pro() ? 'default' : 'after',
828 'condition' => [ 'slider_nav' => [ 'yes' ] ],
829 ];
830
831 $fields['always_show_nav'] = [
832 'type' => 'switch',
833 'label' => esc_html__( 'Always Show Arrows', 'shopbuilder' ),
834 'label_on' => esc_html__( 'On', 'shopbuilder' ),
835 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
836 'description' => esc_html__( 'Switch on to enable always showing navigation arrows.', 'shopbuilder' ),
837 'classes' => $obj->pro_class(),
838 'is_pro' => $status,
839 'condition' => [ 'slider_nav' => [ 'yes' ] ],
840 ];
841
842 if ( rtsb()->has_pro() ) {
843 $fields['always_show_nav']['condition']['slider_nav_position'] = 'standard';
844 }
845
846 $fields['slider_left_arrow_icon'] = [
847 'label' => esc_html__( 'Left Arrow Icon', 'shopbuilder' ),
848 'description' => esc_html__( 'Please choose the slider left arrow icon.', 'shopbuilder' ),
849 'type' => 'icons',
850 'default' => [
851 'value' => 'fas fa-chevron-left',
852 'library' => 'fa-solid',
853 ],
854 'separator' => rtsb()->has_pro() ? 'default' : 'before-short',
855 'condition' => [ 'slider_nav' => 'yes' ],
856 ];
857
858 $fields['slider_right_arrow_icon'] = [
859 'label' => esc_html__( 'Right Arrow Icon', 'shopbuilder' ),
860 'description' => esc_html__( 'Please choose the slider right arrow icon.', 'shopbuilder' ),
861 'type' => 'icons',
862 'default' => [
863 'value' => 'fas fa-chevron-right',
864 'library' => 'fa-solid',
865 ],
866 'condition' => [ 'slider_nav' => 'yes' ],
867 ];
868
869 $fields['slider_pagi'] = [
870 'type' => 'switch',
871 'label' => esc_html__( 'Dot Pagination', 'shopbuilder' ),
872 'label_on' => esc_html__( 'On', 'shopbuilder' ),
873 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
874 'description' => esc_html__( 'Switch on to enable slider dot pagination.', 'shopbuilder' ),
875 'default' => 'yes',
876 ];
877 $fields['slider_dynamic_pagi'] = [
878 'type' => 'switch',
879 'label' => esc_html__( 'Dynamic Pagination', 'shopbuilder' ),
880 'label_on' => esc_html__( 'On', 'shopbuilder' ),
881 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
882 'description' => esc_html__( 'It will keep only few bullets visible at the same time.', 'shopbuilder' ),
883 'condition' => [ 'slider_pagi' => 'yes' ],
884 ];
885 $fields['slider_loop'] = [
886 'type' => 'switch',
887 'label' => esc_html__( 'Infinite Loop', 'shopbuilder' ),
888 'label_on' => esc_html__( 'On', 'shopbuilder' ),
889 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
890 'description' => esc_html__( 'Switch on to enable slider infinite loop.', 'shopbuilder' ),
891 'condition' => [ 'tax_filter!' => [ 'yes' ] ],
892 ];
893
894 $fields['slider_auto_height'] = [
895 'type' => 'switch',
896 'label' => esc_html__( 'Auto Height', 'shopbuilder' ),
897 'label_on' => esc_html__( 'On', 'shopbuilder' ),
898 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
899 'description' => esc_html__( 'Switch on to enable slider dynamic height.', 'shopbuilder' ),
900 ];
901
902 $fields['slider_lazy_load'] = [
903 'type' => 'switch',
904 'label' => esc_html__( 'Image Lazy Load', 'shopbuilder' ),
905 'label_on' => esc_html__( 'On', 'shopbuilder' ),
906 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
907 'description' => esc_html__( 'Switch on to enable slider image lazy load.', 'shopbuilder' ),
908 'condition' => [ 'tax_filter!' => [ 'yes' ] ],
909 ];
910
911 $fields['slide_speed'] = [
912 'type' => 'number',
913 'label' => esc_html__( 'Slide Speed (in ms)', 'shopbuilder' ),
914 'description' => esc_html__( 'Please enter the duration of transition between slides (in ms).', 'shopbuilder' ),
915 'default' => 2000,
916 'separator' => $status ? 'default elementor-control-separator-after' : 'default',
917 ];
918
919 $fields['slider_slide_animation'] = [
920 'type' => 'switch',
921 'label' => esc_html__( 'Enable Slide Effect', 'shopbuilder' ),
922 'label_on' => esc_html__( 'On', 'shopbuilder' ),
923 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
924 'description' => esc_html__( 'Switch on to enable zoom-in effect when sliding.', 'shopbuilder' ),
925 'default' => '',
926 'classes' => $obj->pro_class(),
927 'is_pro' => $status,
928 ];
929
930 $fields['slider_autoplay_note'] = $obj->el_heading(
931 esc_html__( 'Autoplay', 'shopbuilder' ),
932 'before'
933 );
934
935 $fields['slide_autoplay'] = [
936 'type' => 'switch',
937 'label' => esc_html__( 'Enable Autoplay?', 'shopbuilder' ),
938 'label_on' => esc_html__( 'On', 'shopbuilder' ),
939 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
940 'description' => esc_html__( 'Switch on to enable slider autoplay.', 'shopbuilder' ),
941 'default' => 'yes',
942 ];
943
944 $fields['pause_hover'] = [
945 'type' => 'switch',
946 'label' => esc_html__( 'Pause on Mouse Hover?', 'shopbuilder' ),
947 'label_on' => esc_html__( 'On', 'shopbuilder' ),
948 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
949 'description' => esc_html__( 'Switch on to enable slider autoplay pause on mouse hover.', 'shopbuilder' ),
950 'default' => 'yes',
951 'condition' => [ 'slide_autoplay' => 'yes' ],
952 ];
953
954 $fields['autoplay_timeout'] = [
955 'type' => 'number',
956 'label' => esc_html__( 'Autoplay Delay (in ms)', 'shopbuilder' ),
957 'default' => 5000,
958 'description' => esc_html__( 'Please select autoplay interval delay (in ms).', 'shopbuilder' ),
959 'condition' => [ 'slide_autoplay' => 'yes' ],
960 ];
961
962 $fields['slider_control_section_end'] = $obj->end_section();
963
964 return $fields;
965 }
966
967 /**
968 * Title section
969 *
970 * @param object $obj Reference object.
971 *
972 * @return array
973 */
974 public static function product_title( $obj ) {
975 $condition = [
976 'show_title' => [ 'yes' ],
977 ];
978
979 $fields['product_title_section'] = $obj->start_section(
980 esc_html__( 'Product Title', 'shopbuilder' ),
981 self::$tab,
982 [],
983 $condition
984 );
985
986 $fields['title_tag'] = [
987 'type' => 'select2',
988 'label' => esc_html__( 'Product Title Tag', 'shopbuilder' ),
989 'options' => ControlHelper::heading_tags(),
990 'label_block' => true,
991 'default' => 'h3',
992 'description' => esc_html__( 'Please select the product title tag.', 'shopbuilder' ),
993 ];
994
995 // TODO: Will be activated later.
996 // $fields['title_hover'] = [
997 // 'type' => 'switch',
998 // 'label' => esc_html__( 'Title Hover Underline', 'shopbuilder' ),
999 // 'default' => 200,
1000 // 'description' => esc_html__( 'Switch on to enable title hover underline.', 'shopbuilder' ),
1001 // 'classes' => $obj->pro_class(),
1002 // ];
1003
1004 $fields['title_limit'] = [
1005 'type' => 'select2',
1006 'label' => esc_html__( 'Product Title Limit', 'shopbuilder' ),
1007 'options' => [
1008 'default' => esc_html__( 'Default', 'shopbuilder' ),
1009 '1-line' => esc_html__( 'Show in 1 line', 'shopbuilder' ),
1010 '2-lines' => esc_html__( 'Show in 2 lines', 'shopbuilder' ),
1011 '3-lines' => esc_html__( 'Show in 3 lines', 'shopbuilder' ),
1012 'custom' => esc_html__( 'Custom', 'shopbuilder' ),
1013 ],
1014 'label_block' => true,
1015 'default' => 'default',
1016 'description' => esc_html__( 'Please select the product title limit.', 'shopbuilder' ),
1017 ];
1018
1019 $fields['title_limit_custom'] = [
1020 'type' => 'number',
1021 'label' => esc_html__( 'Custom Character Limit', 'shopbuilder' ),
1022 'default' => 200,
1023 'description' => esc_html__( 'Please enter the product title character limit.', 'shopbuilder' ),
1024 'condition' => [ 'title_limit' => [ 'custom' ] ],
1025 ];
1026
1027 $fields['product_title_section_end'] = $obj->end_section();
1028
1029 return $fields;
1030 }
1031
1032 /**
1033 * Title section
1034 *
1035 * @param object $obj Reference object.
1036 *
1037 * @return array
1038 */
1039 public static function section_title( $obj ) {
1040 $condition = [
1041 'show_section_title' => [ 'yes' ],
1042 ];
1043
1044 $fields['section_title_section'] = $obj->start_section(
1045 esc_html__( 'Section Title', 'shopbuilder' ),
1046 self::$tab,
1047 [],
1048 $condition
1049 );
1050
1051 $fields['section_title_tag'] = [
1052 'type' => 'select2',
1053 'label' => esc_html__( 'Section Title Tag', 'shopbuilder' ),
1054 'options' => ControlHelper::heading_tags(),
1055 'label_block' => true,
1056 'default' => 'h2',
1057 'description' => esc_html__( 'Please select the section title tag.', 'shopbuilder' ),
1058 ];
1059
1060 $fields['section_title_text'] = [
1061 'type' => 'text',
1062 'label' => esc_html__( 'Section Title Text', 'shopbuilder' ),
1063 'default' => esc_html__( 'Section Title', 'shopbuilder' ),
1064 'description' => esc_html__( 'Please enter the section title text.', 'shopbuilder' ),
1065 'label_block' => true,
1066 ];
1067
1068 $fields['section_title_section_end'] = $obj->end_section();
1069
1070 return $fields;
1071 }
1072
1073 /**
1074 * Category Title section
1075 *
1076 * @param object $obj Reference object.
1077 *
1078 * @return array
1079 */
1080 public static function cat_title( $obj ) {
1081 $condition = [
1082 'show_title' => [ 'yes' ],
1083 ];
1084
1085 $fields['category_title_section'] = $obj->start_section(
1086 esc_html__( 'Category Title', 'shopbuilder' ),
1087 self::$tab,
1088 [],
1089 $condition
1090 );
1091
1092 $fields['title_tag'] = [
1093 'type' => 'select2',
1094 'label' => esc_html__( 'Category Title Tag', 'shopbuilder' ),
1095 'options' => ControlHelper::heading_tags(),
1096 'label_block' => true,
1097 'default' => 'h3',
1098 'description' => esc_html__( 'Please select the category title tag.', 'shopbuilder' ),
1099 'separator' => rtsb()->has_pro() ? 'before-short' : 'default',
1100 ];
1101
1102 $fields['show_custom_title'] = [
1103 'type' => 'switch',
1104 'label' => esc_html__( 'Enable Custom Title?', 'shopbuilder' ),
1105 'description' => esc_html__( 'Switch on to display alternate custom title.', 'shopbuilder' ),
1106 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1107 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1108 'classes' => $obj->pro_class(),
1109 'separator' => rtsb()->has_pro() ? 'before-short' : 'default',
1110 'condition' => [ 'layout' => [ 'category-single-layout1' ] ],
1111 ];
1112
1113 $fields['custom_title'] = [
1114 'type' => 'textarea',
1115 'label' => esc_html__( 'Alternate Custom Title', 'shopbuilder' ),
1116 'description' => esc_html__( 'Please enter an alternate custom title.', 'shopbuilder' ),
1117 'condition' => [
1118 'show_custom_title' => [ 'yes' ],
1119 'layout' => [ 'category-single-layout1' ],
1120 ],
1121 'classes' => $obj->pro_class(),
1122 'separator' => rtsb()->has_pro() ? 'before-short' : 'default',
1123 ];
1124
1125 $fields['title_limit'] = [
1126 'type' => 'select2',
1127 'label' => esc_html__( 'Category Title Limit', 'shopbuilder' ),
1128 'options' => [
1129 'default' => esc_html__( 'Default', 'shopbuilder' ),
1130 '1-line' => esc_html__( 'Show in 1 line', 'shopbuilder' ),
1131 '2-lines' => esc_html__( 'Show in 2 lines', 'shopbuilder' ),
1132 '3-lines' => esc_html__( 'Show in 3 lines', 'shopbuilder' ),
1133 'custom' => esc_html__( 'Custom', 'shopbuilder' ),
1134 ],
1135 'label_block' => true,
1136 'default' => 'default',
1137 'separator' => rtsb()->has_pro() ? 'default' : 'before',
1138 'description' => esc_html__( 'Please select the category title limit.', 'shopbuilder' ),
1139 ];
1140
1141 $fields['title_limit_custom'] = [
1142 'type' => 'number',
1143 'label' => esc_html__( 'Custom Character Limit', 'shopbuilder' ),
1144 'default' => 200,
1145 'description' => esc_html__( 'Please select the category title custom limit.', 'shopbuilder' ),
1146 'condition' => [ 'title_limit' => [ 'custom' ] ],
1147 ];
1148
1149 $fields['category_title_section_end'] = $obj->end_section();
1150
1151 return $fields;
1152 }
1153
1154 /**
1155 * Excerpt section
1156 *
1157 * @param object $obj Reference object.
1158 *
1159 * @return array
1160 */
1161 public static function product_excerpt( $obj ) {
1162 $condition = [
1163 'show_short_desc' => [ 'yes' ],
1164 ];
1165
1166 $fields['product_excerpt_section'] = $obj->start_section(
1167 esc_html__( 'Short Description', 'shopbuilder' ),
1168 self::$tab,
1169 [],
1170 $condition
1171 );
1172
1173 $fields['excerpt_limit'] = [
1174 'type' => 'select2',
1175 'label' => esc_html__( 'Short Description Limit', 'shopbuilder' ),
1176 'description' => esc_html__( 'Please select the product short description limit.', 'shopbuilder' ),
1177 'options' => [
1178 'default' => esc_html__( 'Default', 'shopbuilder' ),
1179 '1-line' => esc_html__( 'Show in 1 line', 'shopbuilder' ),
1180 '2-lines' => esc_html__( 'Show in 2 lines', 'shopbuilder' ),
1181 '3-lines' => esc_html__( 'Show in 3 lines', 'shopbuilder' ),
1182 'custom' => esc_html__( 'Custom', 'shopbuilder' ),
1183 ],
1184 'label_block' => true,
1185 'default' => 'default',
1186 ];
1187
1188 $fields['excerpt_limit_custom'] = [
1189 'type' => 'number',
1190 'label' => esc_html__( 'Custom Character Limit', 'shopbuilder' ),
1191 'default' => 200,
1192 'description' => esc_html__( 'Please enter the product short description character limit.', 'shopbuilder' ),
1193 'condition' => [ 'excerpt_limit' => [ 'custom' ] ],
1194 ];
1195
1196 $fields['product_excerpt_section_end'] = $obj->end_section();
1197
1198 return $fields;
1199 }
1200
1201 /**
1202 * Category Excerpt section
1203 *
1204 * @param object $obj Reference object.
1205 *
1206 * @return array
1207 */
1208 public static function cat_excerpt( $obj ) {
1209 $condition = [
1210 'show_short_desc' => [ 'yes' ],
1211 ];
1212
1213 $fields['cat_excerpt_section'] = $obj->start_section(
1214 esc_html__( 'Category Description', 'shopbuilder' ),
1215 self::$tab,
1216 [],
1217 $condition
1218 );
1219
1220 $fields['desciption_note'] = [
1221 'type' => 'html',
1222 'raw' => '',
1223 'content_classes' => 'elementor-panel-heading-title',
1224 'condition' => [ 'layout' => [ 'category-single-layout1' ] ],
1225 ];
1226
1227 $fields['show_custom_description'] = [
1228 'type' => 'switch',
1229 'label' => esc_html__( 'Enable Custom Description?', 'shopbuilder' ),
1230 'description' => esc_html__( 'Switch on to display alternate custom description.', 'shopbuilder' ),
1231 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1232 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1233 'classes' => $obj->pro_class(),
1234 'separator' => rtsb()->has_pro() ? 'before-short' : $obj->pro_class(),
1235 'condition' => [ 'layout' => [ 'category-single-layout1' ] ],
1236 ];
1237
1238 $fields['custom_description'] = [
1239 'type' => 'textarea',
1240 'label' => esc_html__( 'Alternate Custom Description', 'shopbuilder' ),
1241 'description' => esc_html__( 'Please enter an alternate custom description.', 'shopbuilder' ),
1242 'condition' => [
1243 'show_custom_description' => [ 'yes' ],
1244 'layout' => [ 'category-single-layout1' ],
1245 ],
1246 'classes' => $obj->pro_class(),
1247 'separator' => rtsb()->has_pro() ? 'before-short' : 'default',
1248 ];
1249
1250 $fields['excerpt_position'] = [
1251 'type' => 'select2',
1252 'label' => esc_html__( 'Category Description Position', 'shopbuilder' ),
1253 'description' => esc_html__( 'Please select the category short description position.', 'shopbuilder' ),
1254 'options' => [
1255 'above' => esc_html__( 'Top', 'shopbuilder' ),
1256 'below' => esc_html__( 'Bottom', 'shopbuilder' ),
1257 ],
1258 'label_block' => true,
1259 'condition' => [ 'layout!' => [ 'category-layout2' ] ],
1260 'default' => 'below',
1261 ];
1262
1263 $fields['excerpt_limit'] = [
1264 'type' => 'select2',
1265 'label' => esc_html__( 'Category Description Limit', 'shopbuilder' ),
1266 'description' => esc_html__( 'Please select the category short description limit.', 'shopbuilder' ),
1267 'options' => [
1268 'default' => esc_html__( 'Default', 'shopbuilder' ),
1269 '1-line' => esc_html__( 'Show in 1 line', 'shopbuilder' ),
1270 '2-lines' => esc_html__( 'Show in 2 lines', 'shopbuilder' ),
1271 '3-lines' => esc_html__( 'Show in 3 lines', 'shopbuilder' ),
1272 'custom' => esc_html__( 'Custom', 'shopbuilder' ),
1273 ],
1274 'label_block' => true,
1275 'default' => 'default',
1276 ];
1277
1278 $fields['excerpt_limit_custom'] = [
1279 'type' => 'number',
1280 'label' => esc_html__( 'Custom Character Limit', 'shopbuilder' ),
1281 'default' => 200,
1282 'description' => esc_html__( 'Please select the category short description custom limit.', 'shopbuilder' ),
1283 'condition' => [ 'excerpt_limit' => [ 'custom' ] ],
1284 ];
1285
1286 $fields['cat_excerpt_section_end'] = $obj->end_section();
1287
1288 return $fields;
1289 }
1290
1291 /**
1292 * Variation swatch section
1293 *
1294 * @param object $obj Reference object.
1295 *
1296 * @return array
1297 */
1298 public static function variation_swatch( $obj ) {
1299 if ( ! function_exists( 'rtwpvsp' ) ) {
1300 return [];
1301 }
1302
1303 $condition = [
1304 'show_swatches' => [ 'yes' ],
1305 ];
1306
1307 $fields['variation_swatch_section'] = $obj->start_section(
1308 esc_html__( 'Variation Swatches', 'shopbuilder' ),
1309 self::$tab,
1310 [],
1311 $condition
1312 );
1313
1314 $fields['swatch_position'] = [
1315 'type' => 'select2',
1316 'label' => esc_html__( 'Swatches Display Position', 'shopbuilder' ),
1317 'description' => esc_html__( 'Please select the variation swatches display position.', 'shopbuilder' ),
1318 'options' => [
1319 'top' => esc_html__( 'Top of Content', 'shopbuilder' ),
1320 'title' => esc_html__( 'With Product Title', 'shopbuilder' ),
1321 'price' => esc_html__( 'WIth Product Price', 'shopbuilder' ),
1322 ],
1323 'label_block' => true,
1324 'default' => 'top',
1325 ];
1326
1327 $fields['swatch_type'] = [
1328 'type' => 'select2',
1329 'label' => esc_html__( 'Swatches Type', 'shopbuilder' ),
1330 'description' => esc_html__( 'Please select the variation swatches display type (only work with color swatch).', 'shopbuilder' ),
1331 'options' => [
1332 'square' => esc_html__( 'Square', 'shopbuilder' ),
1333 'circle' => esc_html__( 'Circle', 'shopbuilder' ),
1334 ],
1335 'label_block' => true,
1336 'default' => 'circle',
1337 ];
1338
1339 $fields['swatch_margin'] = [
1340 'mode' => 'responsive',
1341 'type' => 'dimensions',
1342 'label' => esc_html__( 'Margin', 'shopbuilder' ),
1343 'size_units' => [ 'px', '%', 'em' ],
1344 'selectors' => [ '{{WRAPPER}} .rtsb-swatches' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
1345 ];
1346
1347 $fields['variation_swatch_section_end'] = $obj->end_section();
1348
1349 return $fields;
1350 }
1351
1352 /**
1353 * Badge section
1354 *
1355 * @param object $obj Reference object.
1356 *
1357 * @return array
1358 */
1359 public static function badges( $obj ) {
1360 $condition = [
1361 'show_badges' => [ 'yes' ],
1362 'layout!' => [ 'category-layout1', 'category-layout2' ],
1363 ];
1364
1365 $fields['badges_section'] = $obj->start_section(
1366 esc_html__( 'Badges', 'shopbuilder' ),
1367 self::$tab,
1368 [],
1369 $condition
1370 );
1371
1372 $fields['custom_badge_preset'] = [
1373 'type' => 'rtsb-image-selector',
1374 'label' => esc_html__( 'Custom Badge Appearance', 'shopbuilder' ),
1375 'options' => ControlHelper::badge_presets(),
1376 'default' => 'preset1',
1377 ];
1378
1379 $fields['sale_badges_type'] = [
1380 'type' => 'select2',
1381 'label' => esc_html__( 'Sale Badge Type', 'shopbuilder' ),
1382 'description' => esc_html__( 'Please select the badge type.', 'shopbuilder' ),
1383 'options' => [
1384 'percentage' => esc_html__( 'Show Sale Percentage', 'shopbuilder' ),
1385 'text' => esc_html__( 'Show Sale Text', 'shopbuilder' ),
1386 ],
1387 'default' => 'percentage',
1388 'label_block' => true,
1389 'condition' => [ 'layout!' => [ 'category-single-layout1', 'category-single-layout2', 'category-layout1', 'category-layout2', 'category-layout3' ] ],
1390 ];
1391
1392 $fields['sale_badges_text'] = [
1393 'type' => 'text',
1394 'label' => esc_html__( 'Sale Badge Text', 'shopbuilder' ),
1395 'default' => esc_html__( 'Sale', 'shopbuilder' ),
1396 'description' => esc_html__( 'Please enter the sale badge text.', 'shopbuilder' ),
1397 'label_block' => true,
1398 'condition' => [
1399 'sale_badges_type' => [ 'text' ],
1400 'layout!' => [ 'category-single-layout1', 'category-single-layout2', 'category-layout1', 'category-layout2', 'category-layout3' ],
1401 ],
1402 ];
1403
1404 $fields['stock_badges_text'] = [
1405 'type' => 'text',
1406 'label' => esc_html__( 'Out of Stock Badge Text', 'shopbuilder' ),
1407 'default' => esc_html__( 'Out of Stock', 'shopbuilder' ),
1408 'description' => esc_html__( 'Please enter the out of stock badge text.', 'shopbuilder' ),
1409 'label_block' => true,
1410 'condition' => [ 'layout!' => [ 'category-single-layout1', 'category-single-layout2', 'category-layout1', 'category-layout2', 'category-layout3' ] ],
1411 ];
1412
1413 $fields['custom_badge_text'] = [
1414 'type' => 'text',
1415 'label' => esc_html__( 'Custom Badge Text', 'shopbuilder' ),
1416 'description' => esc_html__( 'Please enter the custom badge text.', 'shopbuilder' ),
1417 'label_block' => true,
1418 'default' => esc_html__( 'Popular', 'shopbuilder' ),
1419 'condition' => [ 'layout' => [ 'category-single-layout1', 'category-single-layout2', 'category-layout1', 'category-layout2' ] ],
1420 ];
1421
1422 $fields['badges_section_end'] = $obj->end_section();
1423
1424 return apply_filters( 'rtsb/elementor/badges', $fields, $obj );
1425 }
1426
1427 /**
1428 * Count section
1429 *
1430 * @param object $obj Reference object.
1431 *
1432 * @return array
1433 */
1434 public static function cat_count_settings( $obj ) {
1435 $condition = [
1436 'show_count' => [ 'yes' ],
1437 ];
1438
1439 $fields['count_section'] = $obj->start_section(
1440 esc_html__( 'Product Count', 'shopbuilder' ),
1441 self::$tab,
1442 [],
1443 $condition
1444 );
1445
1446 $fields['count_display_type'] = [
1447 'type' => 'select2',
1448 'label' => esc_html__( 'Display Position', 'shopbuilder' ),
1449 'description' => esc_html__( 'Please choose the count display position.', 'shopbuilder' ),
1450 'options' => [
1451 'flex' => esc_html__( 'Same Line with Title', 'shopbuilder' ),
1452 'block' => esc_html__( 'After Title', 'shopbuilder' ),
1453 ],
1454 'label_block' => true,
1455 'default' => 'block',
1456 'render_type' => 'template',
1457 'condition' => [ 'layout!' => [ 'category-layout2' ] ],
1458 'selectors' => [
1459 $obj->selectors['cat_count_settings']['count_display_type'] => 'display: {{VALUE}};',
1460 ],
1461 ];
1462
1463 $fields['before_count'] = [
1464 'type' => 'text',
1465 'label' => esc_html__( 'Text Before Count', 'shopbuilder' ),
1466 'description' => esc_html__( 'Please enter the text to show before count.', 'shopbuilder' ),
1467 ];
1468
1469 $fields['after_count'] = [
1470 'type' => 'text',
1471 'label' => esc_html__( 'Text After Count', 'shopbuilder' ),
1472 'description' => esc_html__( 'Please enter the text to show after count.', 'shopbuilder' ),
1473 'default' => esc_html__( ' Products', 'shopbuilder' ),
1474 ];
1475
1476 $fields['count_section_end'] = $obj->end_section();
1477
1478 return $fields;
1479 }
1480
1481 /**
1482 * Pagination section
1483 *
1484 * @param object $obj Reference object.
1485 *
1486 * @return array
1487 */
1488 public static function links( $obj ) {
1489 $fields['links_section'] = $obj->start_section(
1490 esc_html__( 'Links', 'shopbuilder' ),
1491 self::$tab
1492 );
1493 $obj->start_section( 'links_section', esc_html__( 'Detail Page', 'shopbuilder' ), self::$tab );
1494
1495 $fields['title_link'] = [
1496 'type' => 'switch',
1497 'label' => esc_html__( 'Title Clickable?', 'shopbuilder' ),
1498 'description' => esc_html__( 'Switch on to enable title linking.', 'shopbuilder' ),
1499 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1500 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1501 'default' => 'yes',
1502 ];
1503
1504 $fields['image_link'] = [
1505 'type' => 'switch',
1506 'label' => esc_html__( 'Image Clickable?', 'shopbuilder' ),
1507 'description' => esc_html__( 'Switch on to enable image linking.', 'shopbuilder' ),
1508 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1509 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1510 'default' => 'yes',
1511 ];
1512
1513 $fields['hover_btn_note'] = $obj->el_heading(
1514 esc_html__( 'Hover Button', 'shopbuilder' ),
1515 'before',
1516 [],
1517 [ 'layout' => [ 'grid-layout2', 'slider-layout2' ] ]
1518 );
1519
1520 $fields['hover_btn_text'] = [
1521 'type' => 'text',
1522 'label' => esc_html__( 'Hover Button Text', 'shopbuilder' ),
1523 'description' => esc_html__( 'Please enter the button text.', 'shopbuilder' ),
1524 'default' => esc_html__( 'See Details', 'shopbuilder' ),
1525 'condition' => [ 'layout' => [ 'grid-layout2', 'slider-layout2' ] ],
1526 ];
1527
1528 $fields['show_hover_btn_icon'] = [
1529 'type' => 'switch',
1530 'label' => esc_html__( 'Enable Hover Button Icon?', 'shopbuilder' ),
1531 'description' => esc_html__( 'Switch on to enable hover button icon.', 'shopbuilder' ),
1532 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1533 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1534 'default' => 'yes',
1535 'condition' => [ 'layout' => [ 'grid-layout2', 'slider-layout2' ] ],
1536 ];
1537
1538 $fields['hover_btn_icon'] = [
1539 'type' => 'icons',
1540 'label' => esc_html__( 'Choose Icon', 'shopbuilder' ),
1541 'description' => esc_html__( 'Please choose the hover button icon.', 'shopbuilder' ),
1542 'default' => [
1543 'value' => 'fas fa-angle-right',
1544 'library' => 'fa-solid',
1545 ],
1546 'condition' => [
1547 'show_hover_btn_icon' => [ 'yes' ],
1548 'layout' => [ 'grid-layout2', 'slider-layout2' ],
1549 ],
1550 ];
1551
1552 $fields['custom_link'] = [
1553 'type' => 'link',
1554 'label' => esc_html__( 'Alternate Custom Link', 'shopbuilder' ),
1555 'description' => esc_html__( 'Please enter an alternate custom link.', 'shopbuilder' ),
1556 'placeholder' => esc_html__( 'https://custom-link.com', 'shopbuilder' ),
1557 'options' => [ 'url', 'is_external', 'nofollow' ],
1558 'condition' => [ 'layout' => [ 'category-single-layout1' ] ],
1559 ];
1560
1561 $fields['links_section_end'] = $obj->end_section();
1562
1563 return $fields;
1564 }
1565 }
1566