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

1,559 lines 52.0 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 ( ! empty( $wishlist ) && '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 ( ! empty( $quick_view ) && '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 ( ! empty( $compare ) && '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
878 $fields['slider_loop'] = [
879 'type' => 'switch',
880 'label' => esc_html__( 'Infinite Loop', 'shopbuilder' ),
881 'label_on' => esc_html__( 'On', 'shopbuilder' ),
882 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
883 'description' => esc_html__( 'Switch on to enable slider infinite loop.', 'shopbuilder' ),
884 'condition' => [ 'tax_filter!' => [ 'yes' ] ],
885 ];
886
887 $fields['slider_auto_height'] = [
888 'type' => 'switch',
889 'label' => esc_html__( 'Auto Height', 'shopbuilder' ),
890 'label_on' => esc_html__( 'On', 'shopbuilder' ),
891 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
892 'description' => esc_html__( 'Switch on to enable slider dynamic height.', 'shopbuilder' ),
893 ];
894
895 $fields['slider_lazy_load'] = [
896 'type' => 'switch',
897 'label' => esc_html__( 'Image Lazy Load', 'shopbuilder' ),
898 'label_on' => esc_html__( 'On', 'shopbuilder' ),
899 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
900 'description' => esc_html__( 'Switch on to enable slider image lazy load.', 'shopbuilder' ),
901 'condition' => [ 'tax_filter!' => [ 'yes' ] ],
902 ];
903
904 $fields['slide_speed'] = [
905 'type' => 'number',
906 'label' => esc_html__( 'Slide Speed (in ms)', 'shopbuilder' ),
907 'description' => esc_html__( 'Please enter the duration of transition between slides (in ms).', 'shopbuilder' ),
908 'default' => 2000,
909 'separator' => $status ? 'default elementor-control-separator-after' : 'default',
910 ];
911
912 $fields['slider_slide_animation'] = [
913 'type' => 'switch',
914 'label' => esc_html__( 'Enable Slide Effect', 'shopbuilder' ),
915 'label_on' => esc_html__( 'On', 'shopbuilder' ),
916 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
917 'description' => esc_html__( 'Switch on to enable zoom-in effect when sliding.', 'shopbuilder' ),
918 'default' => '',
919 'classes' => $obj->pro_class(),
920 'is_pro' => $status,
921 ];
922
923 $fields['slider_autoplay_note'] = $obj->el_heading(
924 esc_html__( 'Autoplay', 'shopbuilder' ),
925 'before'
926 );
927
928 $fields['slide_autoplay'] = [
929 'type' => 'switch',
930 'label' => esc_html__( 'Enable Autoplay?', 'shopbuilder' ),
931 'label_on' => esc_html__( 'On', 'shopbuilder' ),
932 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
933 'description' => esc_html__( 'Switch on to enable slider autoplay.', 'shopbuilder' ),
934 'default' => 'yes',
935 ];
936
937 $fields['pause_hover'] = [
938 'type' => 'switch',
939 'label' => esc_html__( 'Pause on Mouse Hover?', 'shopbuilder' ),
940 'label_on' => esc_html__( 'On', 'shopbuilder' ),
941 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
942 'description' => esc_html__( 'Switch on to enable slider autoplay pause on mouse hover.', 'shopbuilder' ),
943 'default' => 'yes',
944 'condition' => [ 'slide_autoplay' => 'yes' ],
945 ];
946
947 $fields['autoplay_timeout'] = [
948 'type' => 'number',
949 'label' => esc_html__( 'Autoplay Delay (in ms)', 'shopbuilder' ),
950 'default' => 5000,
951 'description' => esc_html__( 'Please select autoplay interval delay (in ms).', 'shopbuilder' ),
952 'condition' => [ 'slide_autoplay' => 'yes' ],
953 ];
954
955 $fields['slider_control_section_end'] = $obj->end_section();
956
957 return $fields;
958 }
959
960 /**
961 * Title section
962 *
963 * @param object $obj Reference object.
964 *
965 * @return array
966 */
967 public static function product_title( $obj ) {
968 $condition = [
969 'show_title' => [ 'yes' ],
970 ];
971
972 $fields['product_title_section'] = $obj->start_section(
973 esc_html__( 'Product Title', 'shopbuilder' ),
974 self::$tab,
975 [],
976 $condition
977 );
978
979 $fields['title_tag'] = [
980 'type' => 'select2',
981 'label' => esc_html__( 'Product Title Tag', 'shopbuilder' ),
982 'options' => ControlHelper::heading_tags(),
983 'label_block' => true,
984 'default' => 'h3',
985 'description' => esc_html__( 'Please select the product title tag.', 'shopbuilder' ),
986 ];
987
988 // TODO: Will be activated later.
989 // $fields['title_hover'] = [
990 // 'type' => 'switch',
991 // 'label' => esc_html__( 'Title Hover Underline', 'shopbuilder' ),
992 // 'default' => 200,
993 // 'description' => esc_html__( 'Switch on to enable title hover underline.', 'shopbuilder' ),
994 // 'classes' => $obj->pro_class(),
995 // ];
996
997 $fields['title_limit'] = [
998 'type' => 'select2',
999 'label' => esc_html__( 'Product Title Limit', 'shopbuilder' ),
1000 'options' => [
1001 'default' => esc_html__( 'Default', 'shopbuilder' ),
1002 '1-line' => esc_html__( 'Show in 1 line', 'shopbuilder' ),
1003 '2-lines' => esc_html__( 'Show in 2 lines', 'shopbuilder' ),
1004 '3-lines' => esc_html__( 'Show in 3 lines', 'shopbuilder' ),
1005 'custom' => esc_html__( 'Custom', 'shopbuilder' ),
1006 ],
1007 'label_block' => true,
1008 'default' => 'default',
1009 'description' => esc_html__( 'Please select the product title limit.', 'shopbuilder' ),
1010 ];
1011
1012 $fields['title_limit_custom'] = [
1013 'type' => 'number',
1014 'label' => esc_html__( 'Custom Character Limit', 'shopbuilder' ),
1015 'default' => 200,
1016 'description' => esc_html__( 'Please enter the product title character limit.', 'shopbuilder' ),
1017 'condition' => [ 'title_limit' => [ 'custom' ] ],
1018 ];
1019
1020 $fields['product_title_section_end'] = $obj->end_section();
1021
1022 return $fields;
1023 }
1024
1025 /**
1026 * Title section
1027 *
1028 * @param object $obj Reference object.
1029 *
1030 * @return array
1031 */
1032 public static function section_title( $obj ) {
1033 $condition = [
1034 'show_section_title' => [ 'yes' ],
1035 ];
1036
1037 $fields['section_title_section'] = $obj->start_section(
1038 esc_html__( 'Section Title', 'shopbuilder' ),
1039 self::$tab,
1040 [],
1041 $condition
1042 );
1043
1044 $fields['section_title_tag'] = [
1045 'type' => 'select2',
1046 'label' => esc_html__( 'Section Title Tag', 'shopbuilder' ),
1047 'options' => ControlHelper::heading_tags(),
1048 'label_block' => true,
1049 'default' => 'h2',
1050 'description' => esc_html__( 'Please select the section title tag.', 'shopbuilder' ),
1051 ];
1052
1053 $fields['section_title_text'] = [
1054 'type' => 'text',
1055 'label' => esc_html__( 'Section Title Text', 'shopbuilder' ),
1056 'default' => esc_html__( 'Section Title', 'shopbuilder' ),
1057 'description' => esc_html__( 'Please enter the section title text.', 'shopbuilder' ),
1058 'label_block' => true,
1059 ];
1060
1061 $fields['section_title_section_end'] = $obj->end_section();
1062
1063 return $fields;
1064 }
1065
1066 /**
1067 * Category Title section
1068 *
1069 * @param object $obj Reference object.
1070 *
1071 * @return array
1072 */
1073 public static function cat_title( $obj ) {
1074 $condition = [
1075 'show_title' => [ 'yes' ],
1076 ];
1077
1078 $fields['category_title_section'] = $obj->start_section(
1079 esc_html__( 'Category Title', 'shopbuilder' ),
1080 self::$tab,
1081 [],
1082 $condition
1083 );
1084
1085 $fields['title_tag'] = [
1086 'type' => 'select2',
1087 'label' => esc_html__( 'Category Title Tag', 'shopbuilder' ),
1088 'options' => ControlHelper::heading_tags(),
1089 'label_block' => true,
1090 'default' => 'h3',
1091 'description' => esc_html__( 'Please select the category title tag.', 'shopbuilder' ),
1092 'separator' => rtsb()->has_pro() ? 'before-short' : 'default',
1093 ];
1094
1095 $fields['show_custom_title'] = [
1096 'type' => 'switch',
1097 'label' => esc_html__( 'Enable Custom Title?', 'shopbuilder' ),
1098 'description' => esc_html__( 'Switch on to display alternate custom title.', 'shopbuilder' ),
1099 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1100 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1101 'classes' => $obj->pro_class(),
1102 'separator' => rtsb()->has_pro() ? 'before-short' : 'default',
1103 'condition' => [ 'layout' => [ 'category-single-layout1' ] ],
1104 ];
1105
1106 $fields['custom_title'] = [
1107 'type' => 'textarea',
1108 'label' => esc_html__( 'Alternate Custom Title', 'shopbuilder' ),
1109 'description' => esc_html__( 'Please enter an alternate custom title.', 'shopbuilder' ),
1110 'condition' => [
1111 'show_custom_title' => [ 'yes' ],
1112 'layout' => [ 'category-single-layout1' ],
1113 ],
1114 'classes' => $obj->pro_class(),
1115 'separator' => rtsb()->has_pro() ? 'before-short' : 'default',
1116 ];
1117
1118 $fields['title_limit'] = [
1119 'type' => 'select2',
1120 'label' => esc_html__( 'Category Title Limit', 'shopbuilder' ),
1121 'options' => [
1122 'default' => esc_html__( 'Default', 'shopbuilder' ),
1123 '1-line' => esc_html__( 'Show in 1 line', 'shopbuilder' ),
1124 '2-lines' => esc_html__( 'Show in 2 lines', 'shopbuilder' ),
1125 '3-lines' => esc_html__( 'Show in 3 lines', 'shopbuilder' ),
1126 'custom' => esc_html__( 'Custom', 'shopbuilder' ),
1127 ],
1128 'label_block' => true,
1129 'default' => 'default',
1130 'separator' => rtsb()->has_pro() ? 'default' : 'before',
1131 'description' => esc_html__( 'Please select the category title limit.', 'shopbuilder' ),
1132 ];
1133
1134 $fields['title_limit_custom'] = [
1135 'type' => 'number',
1136 'label' => esc_html__( 'Custom Character Limit', 'shopbuilder' ),
1137 'default' => 200,
1138 'description' => esc_html__( 'Please select the category title custom limit.', 'shopbuilder' ),
1139 'condition' => [ 'title_limit' => [ 'custom' ] ],
1140 ];
1141
1142 $fields['category_title_section_end'] = $obj->end_section();
1143
1144 return $fields;
1145 }
1146
1147 /**
1148 * Excerpt section
1149 *
1150 * @param object $obj Reference object.
1151 *
1152 * @return array
1153 */
1154 public static function product_excerpt( $obj ) {
1155 $condition = [
1156 'show_short_desc' => [ 'yes' ],
1157 ];
1158
1159 $fields['product_excerpt_section'] = $obj->start_section(
1160 esc_html__( 'Short Description', 'shopbuilder' ),
1161 self::$tab,
1162 [],
1163 $condition
1164 );
1165
1166 $fields['excerpt_limit'] = [
1167 'type' => 'select2',
1168 'label' => esc_html__( 'Short Description Limit', 'shopbuilder' ),
1169 'description' => esc_html__( 'Please select the product short description limit.', 'shopbuilder' ),
1170 'options' => [
1171 'default' => esc_html__( 'Default', 'shopbuilder' ),
1172 '1-line' => esc_html__( 'Show in 1 line', 'shopbuilder' ),
1173 '2-lines' => esc_html__( 'Show in 2 lines', 'shopbuilder' ),
1174 '3-lines' => esc_html__( 'Show in 3 lines', 'shopbuilder' ),
1175 'custom' => esc_html__( 'Custom', 'shopbuilder' ),
1176 ],
1177 'label_block' => true,
1178 'default' => 'default',
1179 ];
1180
1181 $fields['excerpt_limit_custom'] = [
1182 'type' => 'number',
1183 'label' => esc_html__( 'Custom Character Limit', 'shopbuilder' ),
1184 'default' => 200,
1185 'description' => esc_html__( 'Please enter the product short description character limit.', 'shopbuilder' ),
1186 'condition' => [ 'excerpt_limit' => [ 'custom' ] ],
1187 ];
1188
1189 $fields['product_excerpt_section_end'] = $obj->end_section();
1190
1191 return $fields;
1192 }
1193
1194 /**
1195 * Category Excerpt section
1196 *
1197 * @param object $obj Reference object.
1198 *
1199 * @return array
1200 */
1201 public static function cat_excerpt( $obj ) {
1202 $condition = [
1203 'show_short_desc' => [ 'yes' ],
1204 ];
1205
1206 $fields['cat_excerpt_section'] = $obj->start_section(
1207 esc_html__( 'Category Description', 'shopbuilder' ),
1208 self::$tab,
1209 [],
1210 $condition
1211 );
1212
1213 $fields['desciption_note'] = [
1214 'type' => 'html',
1215 'raw' => '',
1216 'content_classes' => 'elementor-panel-heading-title',
1217 'condition' => [ 'layout' => [ 'category-single-layout1' ] ],
1218 ];
1219
1220 $fields['show_custom_description'] = [
1221 'type' => 'switch',
1222 'label' => esc_html__( 'Enable Custom Description?', 'shopbuilder' ),
1223 'description' => esc_html__( 'Switch on to display alternate custom description.', 'shopbuilder' ),
1224 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1225 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1226 'classes' => $obj->pro_class(),
1227 'separator' => rtsb()->has_pro() ? 'before-short' : $obj->pro_class(),
1228 'condition' => [ 'layout' => [ 'category-single-layout1' ] ],
1229 ];
1230
1231 $fields['custom_description'] = [
1232 'type' => 'textarea',
1233 'label' => esc_html__( 'Alternate Custom Description', 'shopbuilder' ),
1234 'description' => esc_html__( 'Please enter an alternate custom description.', 'shopbuilder' ),
1235 'condition' => [
1236 'show_custom_description' => [ 'yes' ],
1237 'layout' => [ 'category-single-layout1' ],
1238 ],
1239 'classes' => $obj->pro_class(),
1240 'separator' => rtsb()->has_pro() ? 'before-short' : 'default',
1241 ];
1242
1243 $fields['excerpt_position'] = [
1244 'type' => 'select2',
1245 'label' => esc_html__( 'Category Description Position', 'shopbuilder' ),
1246 'description' => esc_html__( 'Please select the category short description position.', 'shopbuilder' ),
1247 'options' => [
1248 'above' => esc_html__( 'Top', 'shopbuilder' ),
1249 'below' => esc_html__( 'Bottom', 'shopbuilder' ),
1250 ],
1251 'label_block' => true,
1252 'condition' => [ 'layout!' => [ 'category-layout2' ] ],
1253 'default' => 'below',
1254 ];
1255
1256 $fields['excerpt_limit'] = [
1257 'type' => 'select2',
1258 'label' => esc_html__( 'Category Description Limit', 'shopbuilder' ),
1259 'description' => esc_html__( 'Please select the category short description limit.', 'shopbuilder' ),
1260 'options' => [
1261 'default' => esc_html__( 'Default', 'shopbuilder' ),
1262 '1-line' => esc_html__( 'Show in 1 line', 'shopbuilder' ),
1263 '2-lines' => esc_html__( 'Show in 2 lines', 'shopbuilder' ),
1264 '3-lines' => esc_html__( 'Show in 3 lines', 'shopbuilder' ),
1265 'custom' => esc_html__( 'Custom', 'shopbuilder' ),
1266 ],
1267 'label_block' => true,
1268 'default' => 'default',
1269 ];
1270
1271 $fields['excerpt_limit_custom'] = [
1272 'type' => 'number',
1273 'label' => esc_html__( 'Custom Character Limit', 'shopbuilder' ),
1274 'default' => 200,
1275 'description' => esc_html__( 'Please select the category short description custom limit.', 'shopbuilder' ),
1276 'condition' => [ 'excerpt_limit' => [ 'custom' ] ],
1277 ];
1278
1279 $fields['cat_excerpt_section_end'] = $obj->end_section();
1280
1281 return $fields;
1282 }
1283
1284 /**
1285 * Variation swatch section
1286 *
1287 * @param object $obj Reference object.
1288 *
1289 * @return array
1290 */
1291 public static function variation_swatch( $obj ) {
1292 if ( ! function_exists( 'rtwpvsp' ) ) {
1293 return [];
1294 }
1295
1296 $condition = [
1297 'show_swatches' => [ 'yes' ],
1298 ];
1299
1300 $fields['variation_swatch_section'] = $obj->start_section(
1301 esc_html__( 'Variation Swatches', 'shopbuilder' ),
1302 self::$tab,
1303 [],
1304 $condition
1305 );
1306
1307 $fields['swatch_position'] = [
1308 'type' => 'select2',
1309 'label' => esc_html__( 'Swatches Display Position', 'shopbuilder' ),
1310 'description' => esc_html__( 'Please select the variation swatches display position.', 'shopbuilder' ),
1311 'options' => [
1312 'top' => esc_html__( 'Top of Content', 'shopbuilder' ),
1313 'title' => esc_html__( 'With Product Title', 'shopbuilder' ),
1314 'price' => esc_html__( 'WIth Product Price', 'shopbuilder' ),
1315 ],
1316 'label_block' => true,
1317 'default' => 'top',
1318 ];
1319
1320 $fields['swatch_type'] = [
1321 'type' => 'select2',
1322 'label' => esc_html__( 'Swatches Type', 'shopbuilder' ),
1323 'description' => esc_html__( 'Please select the variation swatches display type (only work with color swatch).', 'shopbuilder' ),
1324 'options' => [
1325 'square' => esc_html__( 'Square', 'shopbuilder' ),
1326 'circle' => esc_html__( 'Circle', 'shopbuilder' ),
1327 ],
1328 'label_block' => true,
1329 'default' => 'circle',
1330 ];
1331
1332 $fields['swatch_margin'] = [
1333 'mode' => 'responsive',
1334 'type' => 'dimensions',
1335 'label' => esc_html__( 'Margin', 'shopbuilder' ),
1336 'size_units' => [ 'px', '%', 'em' ],
1337 'selectors' => [ '{{WRAPPER}} .rtsb-swatches' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
1338 ];
1339
1340 $fields['variation_swatch_section_end'] = $obj->end_section();
1341
1342 return $fields;
1343 }
1344
1345 /**
1346 * Badge section
1347 *
1348 * @param object $obj Reference object.
1349 *
1350 * @return array
1351 */
1352 public static function badges( $obj ) {
1353 $condition = [
1354 'show_badges' => [ 'yes' ],
1355 'layout!' => [ 'category-layout1', 'category-layout2' ],
1356 ];
1357
1358 $fields['badges_section'] = $obj->start_section(
1359 esc_html__( 'Badges', 'shopbuilder' ),
1360 self::$tab,
1361 [],
1362 $condition
1363 );
1364
1365 $fields['custom_badge_preset'] = [
1366 'type' => 'rtsb-image-selector',
1367 'label' => esc_html__( 'Custom Badge Appearance', 'shopbuilder' ),
1368 'options' => ControlHelper::badge_presets(),
1369 'default' => 'preset1',
1370 ];
1371
1372 $fields['sale_badges_type'] = [
1373 'type' => 'select2',
1374 'label' => esc_html__( 'Sale Badge Type', 'shopbuilder' ),
1375 'description' => esc_html__( 'Please select the badge type.', 'shopbuilder' ),
1376 'options' => [
1377 'percentage' => esc_html__( 'Show Sale Percentage', 'shopbuilder' ),
1378 'text' => esc_html__( 'Show Sale Text', 'shopbuilder' ),
1379 ],
1380 'default' => 'percentage',
1381 'label_block' => true,
1382 'condition' => [ 'layout!' => [ 'category-single-layout1', 'category-single-layout2', 'category-layout1', 'category-layout2', 'category-layout3' ] ],
1383 ];
1384
1385 $fields['sale_badges_text'] = [
1386 'type' => 'text',
1387 'label' => esc_html__( 'Sale Badge Text', 'shopbuilder' ),
1388 'default' => esc_html__( 'Sale', 'shopbuilder' ),
1389 'description' => esc_html__( 'Please enter the sale badge text.', 'shopbuilder' ),
1390 'label_block' => true,
1391 'condition' => [
1392 'sale_badges_type' => [ 'text' ],
1393 'layout!' => [ 'category-single-layout1', 'category-single-layout2', 'category-layout1', 'category-layout2', 'category-layout3' ],
1394 ],
1395 ];
1396
1397 $fields['stock_badges_text'] = [
1398 'type' => 'text',
1399 'label' => esc_html__( 'Out of Stock Badge Text', 'shopbuilder' ),
1400 'default' => esc_html__( 'Out of Stock', 'shopbuilder' ),
1401 'description' => esc_html__( 'Please enter the out of stock badge text.', 'shopbuilder' ),
1402 'label_block' => true,
1403 'condition' => [ 'layout!' => [ 'category-single-layout1', 'category-single-layout2', 'category-layout1', 'category-layout2', 'category-layout3' ] ],
1404 ];
1405
1406 $fields['custom_badge_text'] = [
1407 'type' => 'text',
1408 'label' => esc_html__( 'Custom Badge Text', 'shopbuilder' ),
1409 'description' => esc_html__( 'Please enter the custom badge text.', 'shopbuilder' ),
1410 'label_block' => true,
1411 'default' => esc_html__( 'Popular', 'shopbuilder' ),
1412 'condition' => [ 'layout' => [ 'category-single-layout1', 'category-single-layout2', 'category-layout1', 'category-layout2' ] ],
1413 ];
1414
1415 $fields['badges_section_end'] = $obj->end_section();
1416
1417 return apply_filters( 'rtsb/elementor/badges', $fields, $obj );
1418 }
1419
1420 /**
1421 * Count section
1422 *
1423 * @param object $obj Reference object.
1424 *
1425 * @return array
1426 */
1427 public static function cat_count_settings( $obj ) {
1428 $condition = [
1429 'show_count' => [ 'yes' ],
1430 ];
1431
1432 $fields['count_section'] = $obj->start_section(
1433 esc_html__( 'Product Count', 'shopbuilder' ),
1434 self::$tab,
1435 [],
1436 $condition
1437 );
1438
1439 $fields['count_display_type'] = [
1440 'type' => 'select2',
1441 'label' => esc_html__( 'Display Position', 'shopbuilder' ),
1442 'description' => esc_html__( 'Please choose the count display position.', 'shopbuilder' ),
1443 'options' => [
1444 'flex' => esc_html__( 'Same Line with Title', 'shopbuilder' ),
1445 'block' => esc_html__( 'After Title', 'shopbuilder' ),
1446 ],
1447 'label_block' => true,
1448 'default' => 'block',
1449 'render_type' => 'template',
1450 'condition' => [ 'layout!' => [ 'category-layout2' ] ],
1451 'selectors' => [
1452 $obj->selectors['cat_count_settings']['count_display_type'] => 'display: {{VALUE}};',
1453 ],
1454 ];
1455
1456 $fields['before_count'] = [
1457 'type' => 'text',
1458 'label' => esc_html__( 'Text Before Count', 'shopbuilder' ),
1459 'description' => esc_html__( 'Please enter the text to show before count.', 'shopbuilder' ),
1460 ];
1461
1462 $fields['after_count'] = [
1463 'type' => 'text',
1464 'label' => esc_html__( 'Text After Count', 'shopbuilder' ),
1465 'description' => esc_html__( 'Please enter the text to show after count.', 'shopbuilder' ),
1466 'default' => esc_html__( ' Products', 'shopbuilder' ),
1467 ];
1468
1469 $fields['count_section_end'] = $obj->end_section();
1470
1471 return $fields;
1472 }
1473
1474 /**
1475 * Pagination section
1476 *
1477 * @param object $obj Reference object.
1478 *
1479 * @return array
1480 */
1481 public static function links( $obj ) {
1482 $fields['links_section'] = $obj->start_section(
1483 esc_html__( 'Links', 'shopbuilder' ),
1484 self::$tab
1485 );
1486 $obj->start_section( 'links_section', esc_html__( 'Detail Page', 'shopbuilder' ), self::$tab );
1487
1488 $fields['title_link'] = [
1489 'type' => 'switch',
1490 'label' => esc_html__( 'Title Clickable?', 'shopbuilder' ),
1491 'description' => esc_html__( 'Switch on to enable title linking.', 'shopbuilder' ),
1492 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1493 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1494 'default' => 'yes',
1495 ];
1496
1497 $fields['image_link'] = [
1498 'type' => 'switch',
1499 'label' => esc_html__( 'Image Clickable?', 'shopbuilder' ),
1500 'description' => esc_html__( 'Switch on to enable image linking.', 'shopbuilder' ),
1501 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1502 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1503 'default' => 'yes',
1504 ];
1505
1506 $fields['hover_btn_note'] = $obj->el_heading(
1507 esc_html__( 'Hover Button', 'shopbuilder' ),
1508 'before',
1509 [],
1510 [ 'layout' => [ 'grid-layout2', 'slider-layout2' ] ]
1511 );
1512
1513 $fields['hover_btn_text'] = [
1514 'type' => 'text',
1515 'label' => esc_html__( 'Hover Button Text', 'shopbuilder' ),
1516 'description' => esc_html__( 'Please enter the button text.', 'shopbuilder' ),
1517 'default' => esc_html__( 'See Details', 'shopbuilder' ),
1518 'condition' => [ 'layout' => [ 'grid-layout2', 'slider-layout2' ] ],
1519 ];
1520
1521 $fields['show_hover_btn_icon'] = [
1522 'type' => 'switch',
1523 'label' => esc_html__( 'Enable Hover Button Icon?', 'shopbuilder' ),
1524 'description' => esc_html__( 'Switch on to enable hover button icon.', 'shopbuilder' ),
1525 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1526 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1527 'default' => 'yes',
1528 'condition' => [ 'layout' => [ 'grid-layout2', 'slider-layout2' ] ],
1529 ];
1530
1531 $fields['hover_btn_icon'] = [
1532 'type' => 'icons',
1533 'label' => esc_html__( 'Choose Icon', 'shopbuilder' ),
1534 'description' => esc_html__( 'Please choose the hover button icon.', 'shopbuilder' ),
1535 'default' => [
1536 'value' => 'fas fa-angle-right',
1537 'library' => 'fa-solid',
1538 ],
1539 'condition' => [
1540 'show_hover_btn_icon' => [ 'yes' ],
1541 'layout' => [ 'grid-layout2', 'slider-layout2' ],
1542 ],
1543 ];
1544
1545 $fields['custom_link'] = [
1546 'type' => 'link',
1547 'label' => esc_html__( 'Alternate Custom Link', 'shopbuilder' ),
1548 'description' => esc_html__( 'Please enter an alternate custom link.', 'shopbuilder' ),
1549 'placeholder' => esc_html__( 'https://custom-link.com', 'shopbuilder' ),
1550 'options' => [ 'url', 'is_external', 'nofollow' ],
1551 'condition' => [ 'layout' => [ 'category-single-layout1' ] ],
1552 ];
1553
1554 $fields['links_section_end'] = $obj->end_section();
1555
1556 return $fields;
1557 }
1558 }
1559