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

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