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

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