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

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