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

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