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

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