PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 1.1.4
ShopBuilder – WooCommerce Builder For Elementor v1.1.4
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
← All changes | app/Elementor/Widgets/Controls/LayoutFields.php +1102 -1032 2.1.111.1.4 View file →
@@ -1,1032 +1,1102 @@
1 -<?php
2 -/**
3 - * Elementor Layout Fields Class.
4 - *
5 - * This class contains all the common fields for Layout 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 Layout Fields Class.
22 - */
23 -class LayoutFields {
24 - /**
25 - * Tab name.
26 - *
27 - * @access private
28 - * @static
29 - *
30 - * @var array
31 - */
32 - private static $tab = 'layout';
33 -
34 - /**
35 - * Grid Layout section
36 - *
37 - * @param object $obj Reference object.
38 - *
39 - * @return array
40 - */
41 - public static function grid_layout( $obj ) {
42 - $fields['layout_section'] = $obj->start_section(
43 - esc_html__( 'Presentation', 'shopbuilder' ),
44 - self::$tab
45 - );
46 -
47 - $fields['layout_note'] = $obj->el_heading( esc_html__( 'Predefined Layouts', 'shopbuilder' ) );
48 -
49 - $fields['layout'] = [
50 - 'type' => 'rtsb-image-selector',
51 - 'options' => ControlHelper::grid_layouts(),
52 - 'default' => 'grid-layout1',
53 - ];
54 -
55 - $fields = array_merge( $fields, self::structure( $obj ) );
56 - $fields = array_merge( $fields, self::action_btn_presets( $obj ) );
57 -
58 - $fields['layout_section_end'] = $obj->end_section();
59 -
60 - return apply_filters( 'rtsb/elements/elementor/grid_layout_control', $fields, $obj );
61 - }
62 -
63 - /**
64 - * List Layout section
65 - *
66 - * @param object $obj Reference object.
67 - *
68 - * @return array
69 - */
70 - public static function list_layout( $obj ) {
71 - $fields['layout_section'] = $obj->start_section(
72 - esc_html__( 'Layouts', 'shopbuilder' ),
73 - self::$tab
74 - );
75 -
76 - $fields['layout_note'] = $obj->el_heading( esc_html__( 'Predefined Layouts', 'shopbuilder' ) );
77 -
78 - $fields['layout'] = [
79 - 'type' => 'rtsb-image-selector',
80 - 'options' => ControlHelper::list_layouts(),
81 - 'default' => 'list-layout1',
82 - ];
83 -
84 - $fields = array_merge( $fields, self::structure( $obj ) );
85 - $fields = array_merge( $fields, self::action_btn_presets( $obj ) );
86 -
87 - unset( $fields['action_btn_preset'] );
88 - unset( $fields['action_btn_position'] );
89 -
90 - $fields['layout_section_end'] = $obj->end_section();
91 -
92 - return apply_filters( 'rtsb/elements/elementor/list_layout_control', $fields, $obj );
93 - }
94 -
95 - /**
96 - * Slider Layout section
97 - *
98 - * @param object $obj Reference object.
99 - *
100 - * @return array
101 - */
102 - public static function slider_layout( $obj ) {
103 - $fields['layout_section'] = $obj->start_section(
104 - esc_html__( 'Slider Layouts', 'shopbuilder' ),
105 - self::$tab
106 - );
107 -
108 - $fields['layout_note'] = $obj->el_heading( esc_html__( 'Predefined Layouts', 'shopbuilder' ) );
109 -
110 - $fields['layout'] = [
111 - 'type' => 'rtsb-image-selector',
112 - 'options' => ControlHelper::slider_layouts(),
113 - 'default' => 'slider-layout1',
114 - ];
115 -
116 - $fields = array_merge( $fields, self::structure_slider( $obj ) );
117 - $fields = array_merge( $fields, self::action_btn_presets( $obj ) );
118 -
119 - $fields['layout_section_end'] = $obj->end_section();
120 -
121 - return apply_filters( 'rtsb/elements/elementor/slider_layout_control', $fields, $obj );
122 - }
123 -
124 - /**
125 - * Category Layout section
126 - *
127 - * @param object $obj Reference object.
128 - *
129 - * @return array
130 - */
131 - public static function category_layout( $obj ) {
132 - $fields['layout_section'] = $obj->start_section(
133 - esc_html__( 'Layouts', 'shopbuilder' ),
134 - self::$tab
135 - );
136 -
137 - $fields['layout'] = [
138 - 'type' => 'rtsb-image-selector',
139 - 'options' => ControlHelper::category_layouts(),
140 - 'default' => 'category-layout1',
141 - ];
142 -
143 - $fields = array_merge( $fields, self::structure( $obj ) );
144 -
145 - if ( 'rtsb-product-categories-general' === $obj->rtsb_base ) {
146 - $fields['cols']['render_type'] = 'template';
147 - }
148 -
149 - $fields['cat_height'] = [
150 - 'type' => 'slider',
151 - 'mode' => 'responsive',
152 - 'label' => esc_html__( 'Element Height', 'shopbuilder' ),
153 - 'size_units' => [ 'px', '%' ],
154 - 'range' => [
155 - 'px' => [
156 - 'min' => 0,
157 - 'max' => 1500,
158 - 'step' => 1,
159 - ],
160 - '%' => [
161 - 'min' => 0,
162 - 'max' => 100,
163 - 'step' => 1,
164 - ],
165 - ],
166 - 'description' => esc_html__( 'Please select the element height.', 'shopbuilder' ),
167 - 'selectors' => [
168 - $obj->selectors['category_multi_layout']['cat_height'] => 'height: {{SIZE}}{{UNIT}};',
169 - ],
170 - ];
171 -
172 - $fields['layout_section_end'] = $obj->end_section();
173 -
174 - return apply_filters( 'rtsb/elements/elementor/cat_layout_control', $fields, $obj );
175 - }
176 -
177 - /**
178 - * Category Layout section
179 - *
180 - * @param object $obj Reference object.
181 - *
182 - * @return array
183 - */
184 - public static function category_single_layout( $obj ) {
185 - $fields['layout_section'] = $obj->start_section(
186 - esc_html__( 'Layouts', 'shopbuilder' ),
187 - self::$tab
188 - );
189 -
190 - $fields['layout'] = [
191 - 'type' => 'rtsb-image-selector',
192 - 'options' => ControlHelper::single_category_layouts(),
193 - 'default' => 'category-single-layout1',
194 - ];
195 -
196 - $fields['cat_alignment'] = [
197 - 'mode' => 'responsive',
198 - 'type' => 'choose',
199 - 'label' => esc_html__( 'Element Alignment', 'shopbuilder' ),
200 - 'options' => [
201 - 'left' => [
202 - 'title' => esc_html__( 'Left', 'shopbuilder' ),
203 - 'icon' => 'eicon-text-align-left',
204 - ],
205 - 'center' => [
206 - 'title' => esc_html__( 'Center', 'shopbuilder' ),
207 - 'icon' => 'eicon-text-align-center',
208 - ],
209 - 'right' => [
210 - 'title' => esc_html__( 'Right', 'shopbuilder' ),
211 - 'icon' => 'eicon-text-align-right',
212 - ],
213 - ],
214 - 'selectors' => [
215 - $obj->selectors['category_single_layout']['cat_alignment']['text_align'] => 'text-align: {{VALUE}};',
216 - $obj->selectors['category_single_layout']['cat_alignment']['justify_content'] => 'justify-content: {{VALUE}};',
217 - ],
218 - ];
219 -
220 - $fields['cat_height'] = [
221 - 'type' => 'slider',
222 - 'mode' => 'responsive',
223 - 'label' => esc_html__( 'Element Height', 'shopbuilder' ),
224 - 'size_units' => [ 'px', '%' ],
225 - 'range' => [
226 - 'px' => [
227 - 'min' => 0,
228 - 'max' => 1500,
229 - 'step' => 1,
230 - ],
231 - '%' => [
232 - 'min' => 0,
233 - 'max' => 100,
234 - 'step' => 1,
235 - ],
236 - ],
237 - 'description' => esc_html__( 'Please select the element height.', 'shopbuilder' ),
238 - 'selectors' => [
239 - $obj->selectors['category_single_layout']['cat_height'] => 'height: {{SIZE}}{{UNIT}};',
240 - ],
241 - ];
242 -
243 - $fields['layout_section_end'] = $obj->end_section();
244 -
245 - return apply_filters( 'rtsb/elements/elementor/cat_layout_control', $fields, $obj );
246 - }
247 -
248 - /**
249 - * Action button preset section
250 - *
251 - * @param object $obj Reference object.
252 - *
253 - * @return array
254 - */
255 - public static function action_btn_presets( $obj ) {
256 - $fields['action_btn_note'] = $obj->el_heading( esc_html__( 'Action Button Layouts', 'shopbuilder' ), 'before' );
257 -
258 - $fields['action_btn_preset'] = [
259 - 'type' => 'rtsb-image-selector',
260 - 'description' => esc_html__( 'Please choose your preferred action buttons preset.', 'shopbuilder' ),
261 - 'options' => ControlHelper::action_btn_presets(),
262 - 'default' => 'preset1',
263 - ];
264 -
265 - $fields['action_btn_position'] = [
266 - 'type' => 'select2',
267 - 'label' => esc_html__( 'Action Buttons Position', 'shopbuilder' ),
268 - 'description' => esc_html__( 'Please select the action buttons position.', 'shopbuilder' ),
269 - 'options' => [
270 - 'above' => esc_html__( 'Floating Above Image', 'shopbuilder' ),
271 - 'after' => esc_html__( 'After Content', 'shopbuilder' ),
272 - ],
273 - 'default' => 'above',
274 - 'label_block' => true,
275 - 'condition' => [
276 - 'action_btn_preset' => [ 'preset1', 'preset5' ],
277 - 'layout!' => [ 'grid-layout2', 'slider-layout2' ],
278 - ],
279 - ];
280 -
281 - $fields['action_btn_gap'] = [
282 - 'type' => 'slider',
283 - 'mode' => 'responsive',
284 - 'label' => esc_html__( 'Action Buttons Gap / Spacing (px)', 'shopbuilder' ),
285 - 'size_units' => [ 'px' ],
286 - 'range' => [
287 - 'px' => [
288 - 'min' => 0,
289 - 'max' => 100,
290 - 'step' => 1,
291 - ],
292 - ],
293 - 'description' => esc_html__( 'Please select the action buttons gap in px.', 'shopbuilder' ),
294 - 'selectors' => [
295 - $obj->selectors['action_buttons']['action_btn_gap'] => 'gap: {{SIZE}}{{UNIT}} !important;',
296 - ],
297 - ];
298 -
299 - $fields['action_btn_alignment'] = [
300 - 'type' => 'choose',
301 - 'label' => esc_html__( 'Action Buttons Alignment', 'shopbuilder' ),
302 - 'description' => esc_html__( 'Please select the action buttons alignment.', 'shopbuilder' ),
303 - 'options' => [
304 - 'flex-start' => [
305 - 'title' => esc_html__( 'Left', 'shopbuilder' ),
306 - 'icon' => 'eicon-text-align-left',
307 - ],
308 - 'center' => [
309 - 'title' => esc_html__( 'Center', 'shopbuilder' ),
310 - 'icon' => 'eicon-text-align-center',
311 - ],
312 - 'flex-end' => [
313 - 'title' => esc_html__( 'Right', 'shopbuilder' ),
314 - 'icon' => 'eicon-text-align-right',
315 - ],
316 - ],
317 - 'toggle' => true,
318 - 'condition' => [
319 - 'action_btn_position' => [ 'after' ],
320 - 'action_btn_preset' => [ 'preset1' ],
321 - ],
322 - 'selectors' => [
323 - $obj->selectors['action_buttons']['action_btn_alignment'] => 'justify-content: {{VALUE}};',
324 - ],
325 - ];
326 -
327 - $fields['action_btn_tooltip_position'] = [
328 - 'label' => esc_html__( 'Tooltip Position', 'shopbuilder' ),
329 - 'type' => 'choose',
330 - 'description' => esc_html__( 'Please choose the tooltip position', 'shopbuilder' ),
331 - 'options' => [
332 - 'top' => [
333 - 'title' => esc_html__( 'Top', 'shopbuilder' ),
334 - 'icon' => ' eicon-arrow-up',
335 - ],
336 - 'right' => [
337 - 'title' => esc_html__( 'Right', 'shopbuilder' ),
338 - 'icon' => ' eicon-arrow-right',
339 - ],
340 - 'bottom' => [
341 - 'title' => esc_html__( 'Bottom', 'shopbuilder' ),
342 - 'icon' => ' eicon-arrow-down',
343 - ],
344 - 'left' => [
345 - 'title' => esc_html__( 'Left', 'shopbuilder' ),
346 - 'icon' => ' eicon-arrow-left',
347 - ],
348 - ],
349 - 'default' => 'top',
350 - ];
351 -
352 - return $fields;
353 - }
354 -
355 - /**
356 - * Columns section
357 - *
358 - * @param object $obj Reference object.
359 - *
360 - * @return array
361 - */
362 - public static function structure( $obj ) {
363 - $fields['cols'] = [
364 - 'type' => 'select2',
365 - 'mode' => 'responsive',
366 - 'label' => esc_html__( 'Number of Columns', 'shopbuilder' ),
367 - 'description' => esc_html__( 'Please select the number of columns to show per row.', 'shopbuilder' ),
368 - 'options' => ControlHelper::layout_columns(),
369 - 'label_block' => true,
370 - 'default' => '0',
371 - 'tablet_default' => '2',
372 - 'mobile_default' => '1',
373 - 'required' => true,
374 - 'selectors' => [
375 - $obj->selectors['columns']['cols'] => 'grid-template-columns: repeat({{VALUE}}, minmax(0, 1fr));',
376 - ],
377 - ];
378 -
379 - $fields['image_width'] = [
380 - 'type' => 'slider',
381 - 'mode' => 'responsive',
382 - 'label' => esc_html__( 'Image Width', 'shopbuilder' ),
383 - 'size_units' => [ 'px','%' ],
384 - 'range' => [
385 - '%' => [
386 - 'min' => 0,
387 - 'max' => 100,
388 - 'step' => 1,
389 - ],
390 - ],
391 - 'default' => [
392 - 'unit' => '%',
393 - 'size' => 32,
394 - ],
395 - 'description' => esc_html__( 'Please select the image width in %.', 'shopbuilder' ),
396 - 'selectors' => [
397 - $obj->selectors['columns']['image_width']['image'] => 'flex-basis: {{SIZE}}{{UNIT}}; max-width: {{SIZE}}{{UNIT}};',
398 - // $obj->selectors['columns']['image_width']['content'] => 'flex-basis: calc(100% - {{SIZE}}{{UNIT}}); max-width: calc(100% - {{SIZE}}{{UNIT}});',
399 - ],
400 - 'condition' => [ 'layout' => [ 'list-layout1', 'list-layout2', 'list-layout3', 'list-layout4','list-layout5','list-layout6','list-layout7' ] ],
401 - ];
402 -
403 - $fields['image_gap'] = [
404 - 'type' => 'slider',
405 - 'mode' => 'responsive',
406 - 'label' => esc_html__( 'Image Gap (px)', 'shopbuilder' ),
407 - 'size_units' => [ 'px' ],
408 - 'range' => [
409 - 'px' => [
410 - 'min' => 0,
411 - 'max' => 100,
412 - 'step' => 1,
413 - ],
414 - ],
415 - 'default' => [
416 - 'unit' => 'px',
417 - 'size' => 30,
418 - ],
419 - 'description' => esc_html__( 'Please select the image gap in px.', 'shopbuilder' ),
420 - 'selectors' => [
421 - $obj->selectors['columns']['image_gap'] => 'gap: {{SIZE}}{{UNIT}};',
422 - ],
423 - 'condition' => [ 'layout' => [ 'list-layout1', 'list-layout2', 'list-layout3', 'list-layout4','list-layout5','list-layout6','list-layout7' ] ],
424 - ];
425 -
426 - $fields['v_action_btn_width'] = [
427 - 'type' => 'slider',
428 - 'mode' => 'responsive',
429 - 'label' => esc_html__( 'Vertical Action Buttons Width (px)', 'shopbuilder' ),
430 - 'size_units' => [ 'px' ],
431 - 'range' => [
432 - 'px' => [
433 - 'min' => 0,
434 - 'max' => 500,
435 - 'step' => 1,
436 - ],
437 - ],
438 - 'description' => esc_html__( 'Please select the vertical action buttons width in px.', 'shopbuilder' ),
439 - 'selectors' => [
440 - $obj->selectors['columns']['v_action_btn_width'] => 'flex-basis: {{SIZE}}{{UNIT}};',
441 - ],
442 - 'condition' => [ 'layout' => [ 'list-layout3' ] ],
443 - ];
444 -
445 - // Todo: Need to add later.
446 - /*
447 - $fields['grid_style'] = [
448 - 'type' => 'select2',
449 - 'label' => esc_html__( 'Grid Style', 'shopbuilder' ),
450 - 'options' => [
451 - 'even' => esc_html__( 'Even', 'shopbuilder' ),
452 - 'masonry' => esc_html__( 'Masonry', 'shopbuilder' ),
453 - 'equal' => esc_html__( 'Equal Height', 'shopbuilder' ),
454 - ],
455 - 'label_block' => true,
456 - 'default' => 'even',
457 - 'description' => esc_html__( 'Please select the grid style.', 'shopbuilder' ),
458 - 'classes' => $obj->pro_class(),
459 - ];
460 - */
461 -
462 - return apply_filters( 'rtsb/elements/elementor/columns_control', $fields, $obj );
463 - }
464 -
465 - /**
466 - * Columns section
467 - *
468 - * @param object $obj Reference object.
469 - *
470 - * @return array
471 - */
472 - public static function structure_slider( $obj ) {
473 - $fields['cols'] = [
474 - 'type' => 'select2',
475 - 'mode' => 'responsive',
476 - 'label' => esc_html__( 'Number of Slides (Columns) Per View', 'shopbuilder' ),
477 - 'description' => esc_html__( 'Please select the number of slides to show per view.', 'shopbuilder' ),
478 - 'options' => ControlHelper::layout_columns(),
479 - 'label_block' => true,
480 - 'default' => '0',
481 - 'tablet_default' => '2',
482 - 'mobile_default' => '1',
483 - 'required' => true,
484 - 'separator' => 'default elementor-control-separator-after',
485 - ];
486 -
487 - $fields['rows'] = [
488 - 'type' => 'select2',
489 - 'label' => esc_html__( 'Number of Product Rows', 'shopbuilder' ),
490 - 'description' => rtsb()->has_pro() ? esc_html__( 'Please select the number of slide rows. Slide Rows represents how many rows of slides will be displayed at once.', 'shopbuilder' ) : esc_html__( 'Please select the number of slide rows.', 'shopbuilder' ),
491 - 'options' => [
492 - 1 => esc_html__( 'Layout Default (1 Row)', 'shopbuilder' ),
493 - 2 => esc_html__( '2 Rows', 'shopbuilder' ),
494 - 3 => esc_html__( '3 Rows', 'shopbuilder' ),
495 - 4 => esc_html__( '4 Rows', 'shopbuilder' ),
496 - 5 => esc_html__( '5 Rows', 'shopbuilder' ),
497 - ],
498 - 'label_block' => true,
499 - 'default' => '1',
500 - 'tablet_default' => '1',
501 - 'mobile_default' => '1',
502 - 'required' => true,
503 - 'classes' => $obj->pro_class(),
504 - ];
505 -
506 - $fields['cols_group'] = [
507 - 'type' => 'select2',
508 - 'mode' => 'responsive',
509 - 'label' => esc_html__( 'Number of Slides Per Group', 'shopbuilder' ),
510 - 'description' => rtsb()->has_pro() ? esc_html__( 'Please select the number of slides to show per group. Slides Per Group indicates how many slides will be transitioned at a time.', 'shopbuilder' ) : esc_html__( 'Please select the number of slides to show per group.', 'shopbuilder' ),
511 - 'options' => ControlHelper::layout_columns(),
512 - 'label_block' => true,
513 - 'default' => '0',
514 - 'tablet_default' => '2',
515 - 'mobile_default' => '1',
516 - 'required' => true,
517 - 'classes' => $obj->pro_class(),
518 - ];
519 -
520 - $fields['image_width'] = [
521 - 'type' => 'slider',
522 - 'mode' => 'responsive',
523 - 'label' => esc_html__( 'Image Width', 'shopbuilder' ),
524 - 'size_units' => [ 'px','%' ],
525 - 'range' => [
526 - '%' => [
527 - 'min' => 0,
528 - 'max' => 100,
529 - 'step' => 1,
530 - ],
531 - ],
532 - 'default' => [
533 - 'unit' => '%',
534 - 'size' => 32,
535 - ],
536 - 'description' => esc_html__( 'Please select the image width in %.', 'shopbuilder' ),
537 - 'selectors' => [
538 - $obj->selectors['columns']['image_width']['image'] => 'flex-basis: {{SIZE}}{{UNIT}}; max-width: {{SIZE}}{{UNIT}} !important;',
539 - // $obj->selectors['columns']['image_width']['content'] => 'flex-basis: calc(100% - {{SIZE}}{{UNIT}}); max-width: calc(100% - {{SIZE}}{{UNIT}});',
540 - ],
541 - 'condition' => [ 'layout' => [ 'slider-layout5' ] ],
542 - ];
543 -
544 - $fields['image_gap'] = [
545 - 'type' => 'slider',
546 - 'mode' => 'responsive',
547 - 'label' => esc_html__( 'Image Gap (px)', 'shopbuilder' ),
548 - 'size_units' => [ 'px' ],
549 - 'range' => [
550 - 'px' => [
551 - 'min' => 0,
552 - 'max' => 100,
553 - 'step' => 1,
554 - ],
555 - ],
556 - 'default' => [
557 - 'unit' => 'px',
558 - 'size' => 30,
559 - ],
560 - 'description' => esc_html__( 'Please select the image gap in px.', 'shopbuilder' ),
561 - 'selectors' => [
562 - $obj->selectors['columns']['image_gap'] => 'gap: {{SIZE}}{{UNIT}};',
563 - ],
564 - 'condition' => [ 'layout' => [ 'slider-layout5' ] ],
565 - ];
566 -
567 - return apply_filters( 'rtsb/elements/elementor/columns_control', $fields, $obj );
568 - }
569 -
570 - /**
571 - * Query section
572 - *
573 - * @param object $obj Reference object.
574 - *
575 - * @return array
576 - */
577 - public static function query( $obj ) {
578 - $fields['query_section'] = $obj->start_section(
579 - esc_html__( 'Query', 'shopbuilder' ),
580 - self::$tab
581 - );
582 -
583 - $fields['query_note'] = $obj->el_heading( esc_html__( 'Common Filters', 'shopbuilder' ) );
584 -
585 - $fields['include_posts'] = [
586 - 'type' => 'rt-select2',
587 - 'label' => esc_html__( 'Include Products', 'shopbuilder' ),
588 - 'description' => esc_html__( 'Please select the products to show. Leave it blank to include all products.', 'shopbuilder' ),
589 - 'source_name' => 'post_type',
590 - 'source_type' => 'product',
591 - 'multiple' => true,
592 - 'label_block' => true,
593 - ];
594 -
595 - $fields['exclude_posts'] = [
596 - 'type' => 'rt-select2',
597 - 'label' => esc_html__( 'Exclude Products', 'shopbuilder' ),
598 - 'description' => esc_html__( 'Please select the products to show. Leave it blank to exclude none.', 'shopbuilder' ),
599 - 'source_name' => 'post_type',
600 - 'source_type' => 'product',
601 - 'multiple' => true,
602 - 'label_block' => true,
603 - ];
604 -
605 - $fields['posts_limit'] = [
606 - 'type' => 'number',
607 - 'label' => esc_html__( 'Products Limit', 'shopbuilder' ),
608 - 'description' => esc_html__( 'The number of products to show. Set empty to show all products.', 'shopbuilder' ),
609 - 'default' => 12,
610 - ];
611 -
612 - $fields['posts_offset'] = [
613 - 'type' => 'number',
614 - 'label' => esc_html__( 'Products Offset', 'shopbuilder' ),
615 - 'description' => esc_html__( 'Number of products to skip.', 'shopbuilder' ),
616 - ];
617 -
618 - $fields['category_note'] = $obj->el_heading( esc_html__( 'Taxonomy Filters', 'shopbuilder' ), 'before' );
619 -
620 - $fields['filter_categories'] = [
621 - 'type' => 'rt-select2',
622 - 'label' => esc_html__( 'Filter By Categories', 'shopbuilder' ),
623 - 'description' => esc_html__( 'Select the categories you want to filter, Leave it blank for all categories.', 'shopbuilder' ),
624 - 'source_name' => 'taxonomy',
625 - 'source_type' => 'product_cat',
626 - 'multiple' => true,
627 - 'label_block' => true,
628 - 'minimum_input_length' => 1,
629 - ];
630 -
631 - $fields['filter_tags'] = [
632 - 'type' => 'rt-select2',
633 - 'label' => esc_html__( 'Filter By Tags', 'shopbuilder' ),
634 - 'description' => esc_html__( 'Select the tags you want to filter, Leave it blank for all tags.', 'shopbuilder' ),
635 - 'source_name' => 'taxonomy',
636 - 'source_type' => 'product_tag',
637 - 'multiple' => true,
638 - 'label_block' => true,
639 - 'minimum_input_length' => 1,
640 - ];
641 -
642 - $fields['filter_attributes'] = [
643 - 'type' => 'select2',
644 - 'label' => esc_html__( 'Filter By Attributes', 'shopbuilder' ),
645 - 'description' => esc_html__( 'Select the attributes you want to filter, Leave it blank for all attributes.', 'shopbuilder' ),
646 - 'options' => Fns::get_all_attributes(),
647 - 'multiple' => true,
648 - 'label_block' => true,
649 - 'condition' => [ 'tax_filter!' => [ 'yes' ] ],
650 - ];
651 -
652 - $fields['tax_relation'] = [
653 - 'type' => 'select2',
654 - 'label' => esc_html__( 'Taxonomy relation', 'shopbuilder' ),
655 - 'options' => [
656 - 'OR' => 'Show All Products (OR)',
657 - 'AND' => 'Show Common Products (AND)',
658 - ],
659 - 'default' => 'AND',
660 - 'description' => esc_html__( 'Select the taxonomies relationship. It is applicable if you select more than one taxonomy.', 'shopbuilder' ),
661 - 'label_block' => true,
662 - ];
663 -
664 - $fields['advanced_note'] = $obj->el_heading( esc_html__( 'Advanced Filters', 'shopbuilder' ), 'before' );
665 -
666 - $fields['filter_author'] = [
667 - 'type' => 'rt-select2',
668 - 'label' => esc_html__( 'Filter By Author', 'shopbuilder' ),
669 - 'description' => esc_html__( 'Select the author you want to filter, Leave it blank for all author.', 'shopbuilder' ),
670 - 'source_name' => 'user',
671 - 'multiple' => true,
672 - 'label_block' => true,
673 - 'minimum_input_length' => 1,
674 - 'separator' => rtsb()->has_pro() ? 'default' : 'default elementor-control-separator-after',
675 - ];
676 -
677 - $fields['products_filter'] = [
678 - 'type' => 'select2',
679 - 'label' => esc_html__( 'Display Products By:', 'shopbuilder' ),
680 - 'options' => ControlHelper::filter_products(),
681 - 'default' => rtsb()->has_pro() ? 'recent' : 'best-selling',
682 - 'description' => esc_html__( 'Please select the conditional display of products.', 'shopbuilder' ),
683 - 'label_block' => true,
684 - 'classes' => $obj->pro_class(),
685 - ];
686 -
687 - $fields['sorting_note'] = $obj->el_heading( esc_html__( 'Sorting', 'shopbuilder' ), 'before' );
688 -
689 - $fields['posts_order_by'] = [
690 - 'type' => 'select2',
691 - 'label' => esc_html__( 'Order By', 'shopbuilder' ),
692 - 'options' => ControlHelper::posts_order_by(),
693 - 'default' => 'date',
694 - ];
695 -
696 - if ( rtsb()->has_pro() ) {
697 - $fields['posts_order_by']['condition'] = [ 'products_filter' => 'recent' ];
698 - }
699 -
700 - $fields['posts_order'] = [
701 - 'type' => 'select2',
702 - 'label' => esc_html__( 'Order', 'shopbuilder' ),
703 - 'options' => ControlHelper::posts_order(),
704 - 'default' => 'DESC',
705 - ];
706 -
707 - $fields['query_section_end'] = $obj->end_section();
708 -
709 - return apply_filters( 'rtsb/elements/elementor/query_control', $fields, $obj );
710 - }
711 -
712 - /**
713 - * Query section
714 - *
715 - * @param object $obj Reference object.
716 - *
717 - * @return array
718 - */
719 - public static function additional_query( $obj ) {
720 - $fields['query_section'] = $obj->start_section(
721 - esc_html__( 'Query', 'shopbuilder' ),
722 - self::$tab
723 - );
724 -
725 - $fields['query_note'] = $obj->el_heading( esc_html__( 'Common Filters', 'shopbuilder' ) );
726 -
727 - $fields['posts_limit'] = [
728 - 'type' => 'number',
729 - 'label' => esc_html__( 'Products Limit', 'shopbuilder' ),
730 - 'description' => esc_html__( 'The number of products to show. Set empty to show all products.', 'shopbuilder' ),
731 - 'default' => 12,
732 - ];
733 -
734 - $fields['sorting_note'] = $obj->el_heading( esc_html__( 'Sorting', 'shopbuilder' ), 'before' );
735 -
736 - $fields['posts_order_by'] = [
737 - 'type' => 'select2',
738 - 'label' => esc_html__( 'Order By', 'shopbuilder' ),
739 - 'description' => esc_html__( 'Please choose to reorder products.', 'shopbuilder' ),
740 - 'options' => ControlHelper::posts_order_by(),
741 - 'default' => 'date',
742 - ];
743 -
744 - $fields['posts_order'] = [
745 - 'type' => 'select2',
746 - 'label' => esc_html__( 'Order', 'shopbuilder' ),
747 - 'description' => esc_html__( 'Please choose to reorder products.', 'shopbuilder' ),
748 - 'options' => ControlHelper::posts_order(),
749 - 'default' => 'DESC',
750 - ];
751 -
752 - $fields['query_section_end'] = $obj->end_section();
753 -
754 - return apply_filters( 'rtsb/elements/elementor/query_control', $fields, $obj );
755 - }
756 -
757 - /**
758 - * Category Query section
759 - *
760 - * @param object $obj Reference object.
761 - *
762 - * @return array
763 - */
764 - public static function cat_single_query( $obj ) {
765 - $fields['query_section'] = $obj->start_section(
766 - esc_html__( 'Query', 'shopbuilder' ),
767 - self::$tab
768 - );
769 -
770 - $fields['select_source'] = [
771 - 'type' => 'select2',
772 - 'label' => esc_html__( 'Select Taxonomy', 'shopbuilder' ),
773 - 'options' => Fns::get_tax_list(),
774 - 'description' => esc_html__( 'Please select the taxonomy.', 'shopbuilder' ),
775 - 'label_block' => true,
776 - 'default' => 'product_cat',
777 - ];
778 -
779 - $fields['select_cat'] = [
780 - 'type' => 'rt-select2',
781 - 'label' => esc_html__( 'Choose Category', 'shopbuilder' ),
782 - 'source_name' => 'taxonomy',
783 - 'source_type' => 'product_cat',
784 - 'description' => esc_html__( 'Please select the category to show.', 'shopbuilder' ),
785 - 'label_block' => true,
786 - 'minimum_input_length' => 1,
787 - 'condition' => [
788 - 'select_source' => [ 'product_cat' ],
789 - ],
790 - ];
791 -
792 - $fields['select_tag'] = [
793 - 'type' => 'rt-select2',
794 - 'label' => esc_html__( 'Choose Tag', 'shopbuilder' ),
795 - 'source_name' => 'taxonomy',
796 - 'source_type' => 'product_tag',
797 - 'description' => esc_html__( 'Please select the tag to show.', 'shopbuilder' ),
798 - 'label_block' => true,
799 - 'minimum_input_length' => 1,
800 - 'condition' => [
801 - 'select_source' => [ 'product_tag' ],
802 - ],
803 - ];
804 -
805 - $fields['query_section_end'] = $obj->end_section();
806 -
807 - return apply_filters( 'rtsb/elements/elementor/cat_single_query_control', $fields, $obj );
808 - }
809 -
810 - /**
811 - * Category Query section
812 - *
813 - * @param object $obj Reference object.
814 - *
815 - * @return array
816 - */
817 - public static function cat_query( $obj ) {
818 - $fields['query_section'] = $obj->start_section(
819 - esc_html__( 'Query', 'shopbuilder' ),
820 - self::$tab
821 - );
822 -
823 - $fields['query_note'] = $obj->el_heading( esc_html__( 'Filter', 'shopbuilder' ) );
824 -
825 - $fields['display_cat_by'] = [
826 - 'type' => 'select2',
827 - 'label' => esc_html__( 'Display Categories By:', 'shopbuilder' ),
828 - 'options' => Fns::get_cat_list(),
829 - 'description' => esc_html__( 'Please select what categories will be displayed.', 'shopbuilder' ),
830 - 'label_block' => true,
831 - 'default' => 'all',
832 - ];
833 -
834 - $fields['select_parent_cat'] = [
835 - 'type' => 'rt-select2',
836 - 'label' => esc_html__( 'Select Parent Category', 'shopbuilder' ),
837 - 'source_name' => 'taxonomy',
838 - 'source_type' => 'product_cat',
839 - 'minimum_input_length' => 1,
840 - 'description' => esc_html__( 'Please select the parent category to show.', 'shopbuilder' ),
841 - 'label_block' => true,
842 - 'default' => Fns::get_terms( 'product_cat', true, true ),
843 - 'condition' => [ 'display_cat_by' => [ 'specific_parent' ] ],
844 - ];
845 -
846 - $fields['include_cats'] = [
847 - 'type' => 'rt-select2',
848 - 'label' => esc_html__( 'Select Categories', 'shopbuilder' ),
849 - 'source_name' => 'taxonomy',
850 - 'source_type' => 'product_cat',
851 - 'description' => esc_html__( 'Please select the categories to show.', 'shopbuilder' ),
852 - 'label_block' => true,
853 - 'multiple' => true,
854 - 'minimum_input_length' => 1,
855 - 'condition' => [ 'display_cat_by' => [ 'selection' ] ],
856 - ];
857 -
858 - $fields['include_cat_ids'] = [
859 - 'type' => 'text',
860 - 'label' => esc_html__( 'Enter Category IDs', 'shopbuilder' ),
861 - 'description' => esc_html__( 'Please enter the category IDs separated by comma.', 'shopbuilder' ),
862 - 'label_block' => true,
863 - 'condition' => [ 'display_cat_by' => [ 'cat_ids' ] ],
864 - ];
865 -
866 - $fields['exclude_cats'] = [
867 - 'type' => 'rt-select2',
868 - 'label' => esc_html__( 'Exclude Categories', 'shopbuilder' ),
869 - 'source_name' => 'taxonomy',
870 - 'source_type' => 'product_cat',
871 - 'description' => esc_html__( 'Please select the categories to exclude. Leave it blank to exclude none.', 'shopbuilder' ),
872 - 'multiple' => true,
873 - 'minimum_input_length' => 1,
874 - 'label_block' => true,
875 - 'condition' => [ 'display_cat_by' => [ 'all' ] ],
876 - ];
877 -
878 - $fields['cats_limit'] = [
879 - 'type' => 'number',
880 - 'label' => esc_html__( 'Categories Limit', 'shopbuilder' ),
881 - 'description' => esc_html__( 'The number of categories to show. Set empty to show all categories.', 'shopbuilder' ),
882 - 'condition' => [ 'display_cat_by!' => [ 'selection' ] ],
883 - ];
884 -
885 - $fields['show_top_level_cats'] = [
886 - 'type' => 'switch',
887 - 'label' => __( 'Show only Top Level <br /> Sub-Categories?', 'shopbuilder' ),
888 - 'description' => esc_html__( 'Switch on to display only first level sub-categories.', 'shopbuilder' ),
889 - 'label_on' => esc_html__( 'On', 'shopbuilder' ),
890 - 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
891 - 'condition' => [ 'display_cat_by' => [ 'specific_parent' ] ],
892 - ];
893 -
894 - $fields['show_empty'] = [
895 - 'type' => 'switch',
896 - 'label' => esc_html__( 'Show Empty Categories?', 'shopbuilder' ),
897 - 'description' => esc_html__( 'Switch on to display empty categories.', 'shopbuilder' ),
898 - 'label_on' => esc_html__( 'On', 'shopbuilder' ),
899 - 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
900 - 'default' => 'yes',
901 - ];
902 -
903 - $fields['show_uncategorized'] = [
904 - 'type' => 'switch',
905 - 'label' => __( 'Show Uncategorized <br />(Or Default Category)?', 'shopbuilder' ),
906 - 'description' => esc_html__( 'Switch on to display uncategorized.', 'shopbuilder' ),
907 - 'label_on' => esc_html__( 'On', 'shopbuilder' ),
908 - 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
909 - 'default' => 'yes',
910 - 'condition' => [ 'display_cat_by' => [ 'all' ] ],
911 - ];
912 -
913 - $fields['show_subcats'] = [
914 - 'type' => 'switch',
915 - 'label' => esc_html__( 'Show Sub-Categories?', 'shopbuilder' ),
916 - 'description' => esc_html__( 'Switch on to display subcategories.', 'shopbuilder' ),
917 - 'label_on' => esc_html__( 'On', 'shopbuilder' ),
918 - 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
919 - 'default' => 'yes',
920 - 'condition' => [ 'display_cat_by' => [ 'all' ] ],
921 - ];
922 -
923 - $fields['sorting_note'] = $obj->el_heading( esc_html__( 'Sorting', 'shopbuilder' ), 'before' );
924 -
925 - $fields['cats_order_by'] = [
926 - 'type' => 'select2',
927 - 'label' => esc_html__( 'Order By', 'shopbuilder' ),
928 - 'description' => esc_html__( 'Please choose to reorder categories.', 'shopbuilder' ),
929 - 'options' => ControlHelper::cats_order_by(),
930 - 'default' => 'name',
931 - ];
932 -
933 - $fields['cats_order'] = [
934 - 'type' => 'select2',
935 - 'label' => esc_html__( 'Order', 'shopbuilder' ),
936 - 'description' => esc_html__( 'Please choose to reorder categories.', 'shopbuilder' ),
937 - 'options' => ControlHelper::posts_order(),
938 - 'default' => 'ASC',
939 - ];
940 -
941 - $fields['query_section_end'] = $obj->end_section();
942 -
943 - return apply_filters( 'rtsb/elements/elementor/cat_query_control', $fields, $obj );
944 - }
945 -
946 - /**
947 - * Pagination section
948 - *
949 - * @param object $obj Reference object.
950 - *
951 - * @return array
952 - */
953 - public static function pagination( $obj ) {
954 - $fields['pagination_section'] = $obj->start_section(
955 - esc_html__( 'Pagination', 'shopbuilder' ),
956 - self::$tab,
957 - [],
958 - rtsb()->has_pro() ? [ 'tax_filter!' => [ 'yes' ] ] : []
959 - );
960 -
961 - $fields['show_pagination'] = [
962 - 'type' => 'switch',
963 - 'label' => esc_html__( 'Enable Pagination?', 'shopbuilder' ),
964 - 'description' => esc_html__( 'Switch on to enable pagination.', 'shopbuilder' ),
965 - 'label_on' => esc_html__( 'On', 'shopbuilder' ),
966 - 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
967 - ];
968 -
969 - $fields['pagination_per_page'] = [
970 - 'type' => 'number',
971 - 'label' => esc_html__( 'Number of Posts Per Page', 'shopbuilder' ),
972 - 'default' => 8,
973 - 'description' => esc_html__( 'Please enter the number of products per page to show.', 'shopbuilder' ),
974 - 'condition' => [ 'show_pagination' => [ 'yes' ] ],
975 - ];
976 -
977 - $pagination_description = esc_html__( 'Please choose the pagination type', 'shopbuilder' );
978 -
979 - if ( ! rtsb()->has_pro() ) {
980 - $upgrade_link = '<span class="elementor-pro-notice"><a target="_blank" href="' . esc_url( rtsb()->pro_version_link() ) . '">Upgrade to PRO</a> to unlock Load More and Ajax Pagination.</span>';
981 - $pagination_description .= $upgrade_link;
982 - }
983 -
984 - $fields['pagination_type'] = [
985 - 'type' => 'select',
986 - 'label' => esc_html__( 'Pagination Type', 'shopbuilder' ),
987 - 'description' => $pagination_description,
988 - 'options' => ControlHelper::pagination_options(),
989 - 'default' => 'pagination',
990 - 'label_block' => true,
991 - 'condition' => [ 'show_pagination' => [ 'yes' ] ],
992 - ];
993 -
994 - $fields['pagination_section_end'] = $obj->end_section();
995 -
996 - return apply_filters( 'rtsb/elementor/pagination_control', $fields, $obj );
997 - }
998 -
999 - /**
1000 - * Filter section
1001 - *
1002 - * @param object $obj Reference object.
1003 - *
1004 - * @return array
1005 - */
1006 - public static function filter( $obj ) {
1007 - $fields['filter_section'] = $obj->start_section(
1008 - esc_html__( 'Ajax Tab Filters', 'shopbuilder' ),
1009 - self::$tab,
1010 - );
1011 -
1012 - $fields['filter_note'] = [
1013 - 'type' => 'html',
1014 - 'raw' => '',
1015 - 'content_classes' => 'elementor-panel-heading-title',
1016 - ];
1017 -
1018 - $fields['tax_filter'] = [
1019 - 'type' => 'switch',
1020 - 'label' => esc_html__( 'Enable Taxonomy Filter Button?', 'shopbuilder' ),
1021 - 'description' => esc_html__( 'Switch on to enable taxonomy filter button.', 'shopbuilder' ),
1022 - 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1023 - 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1024 - 'separator' => $obj->pro_class(),
1025 - 'classes' => $obj->pro_class(),
1026 - ];
1027 -
1028 - $fields['filter_section_end'] = $obj->end_section();
1029 -
1030 - return apply_filters( 'rtsb/elementor/filter_control', $fields, $obj );
1031 - }
1032 -}
1 +<?php
2 +/**
3 + * Elementor Layout Fields Class.
4 + *
5 + * This class contains all the common fields for Layout 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 Layout Fields Class.
22 + */
23 +class LayoutFields {
24 + /**
25 + * Tab name.
26 + *
27 + * @access private
28 + * @static
29 + *
30 + * @var array
31 + */
32 + private static $tab = 'layout';
33 +
34 + /**
35 + * Grid Layout section
36 + *
37 + * @param object $obj Reference object.
38 + * @return array
39 + */
40 + public static function grid_layout( $obj ) {
41 + $fields['layout_section'] = $obj->start_section(
42 + esc_html__( 'Layouts', 'shopbuilder' ),
43 + self::$tab
44 + );
45 +
46 + $fields['layout'] = [
47 + 'type' => 'rtsb-image-selector',
48 + 'options' => ControlHelper::grid_layouts(),
49 + 'default' => 'grid-layout1',
50 + 'separator' => 'default',
51 + ];
52 +
53 + $fields['layout_section_end'] = $obj->end_section();
54 +
55 + return apply_filters( 'rtsb/elements/elementor/grid_layout_control', $fields, $obj );
56 + }
57 +
58 + /**
59 + * List Layout section
60 + *
61 + * @param object $obj Reference object.
62 + * @return array
63 + */
64 + public static function list_layout( $obj ) {
65 + $fields['layout_section'] = $obj->start_section(
66 + esc_html__( 'Layouts', 'shopbuilder' ),
67 + self::$tab
68 + );
69 +
70 + $fields['layout'] = [
71 + 'type' => 'rtsb-image-selector',
72 + 'options' => ControlHelper::list_layouts(),
73 + 'default' => 'list-layout1',
74 + 'separator' => 'default',
75 + ];
76 +
77 + $fields['layout_section_end'] = $obj->end_section();
78 +
79 + return apply_filters( 'rtsb/elements/elementor/list_layout_control', $fields, $obj );
80 + }
81 +
82 + /**
83 + * Slider Layout section
84 + *
85 + * @param object $obj Reference object.
86 + * @return array
87 + */
88 + public static function slider_layout( $obj ) {
89 + $fields['layout_section'] = $obj->start_section(
90 + esc_html__( 'Slider Layouts', 'shopbuilder' ),
91 + self::$tab
92 + );
93 +
94 + $fields['layout'] = [
95 + 'type' => 'rtsb-image-selector',
96 + 'options' => ControlHelper::slider_layouts(),
97 + 'default' => 'slider-layout1',
98 + 'separator' => 'default',
99 + ];
100 +
101 + $fields['layout_section_end'] = $obj->end_section();
102 +
103 + return apply_filters( 'rtsb/elements/elementor/slider_layout_control', $fields, $obj );
104 + }
105 +
106 + /**
107 + * Category Layout section
108 + *
109 + * @param object $obj Reference object.
110 + * @return array
111 + */
112 + public static function category_layout( $obj ) {
113 + $fields['layout_section'] = $obj->start_section(
114 + esc_html__( 'Layouts', 'shopbuilder' ),
115 + self::$tab
116 + );
117 +
118 + $fields['layout'] = [
119 + 'type' => 'rtsb-image-selector',
120 + 'options' => ControlHelper::category_layouts(),
121 + 'default' => 'category-layout1',
122 + 'separator' => 'default',
123 + ];
124 +
125 + $fields['layout_section_end'] = $obj->end_section();
126 +
127 + return apply_filters( 'rtsb/elements/elementor/list_layout_control', $fields, $obj );
128 + }
129 +
130 + /**
131 + * Category Layout section
132 + *
133 + * @param object $obj Reference object.
134 + * @return array
135 + */
136 + public static function category_single_layout( $obj ) {
137 + $fields['layout_section'] = $obj->start_section(
138 + esc_html__( 'Layouts', 'shopbuilder' ),
139 + self::$tab
140 + );
141 +
142 + $fields['layout'] = [
143 + 'type' => 'rtsb-image-selector',
144 + 'options' => ControlHelper::single_category_layouts(),
145 + 'default' => 'category-single-layout1',
146 + 'separator' => 'default',
147 + ];
148 +
149 + $fields['cat_alignment'] = [
150 + 'mode' => 'responsive',
151 + 'type' => 'choose',
152 + 'label' => esc_html__( 'Element Alignment', 'shopbuilder' ),
153 + 'options' => [
154 + 'left' => [
155 + 'title' => esc_html__( 'Left', 'shopbuilder' ),
156 + 'icon' => 'eicon-text-align-left',
157 + ],
158 + 'center' => [
159 + 'title' => esc_html__( 'Center', 'shopbuilder' ),
160 + 'icon' => 'eicon-text-align-center',
161 + ],
162 + 'right' => [
163 + 'title' => esc_html__( 'Right', 'shopbuilder' ),
164 + 'icon' => 'eicon-text-align-right',
165 + ],
166 + ],
167 + 'selectors' => [
168 + $obj->selectors['category_single_layout']['cat_alignment']['text_align'] => 'text-align: {{VALUE}};',
169 + $obj->selectors['category_single_layout']['cat_alignment']['justify_content'] => 'justify-content: {{VALUE}};',
170 + ],
171 + ];
172 +
173 + $fields['cat_height'] = [
174 + 'type' => 'slider',
175 + 'mode' => 'responsive',
176 + 'label' => esc_html__( 'Element Height', 'shopbuilder' ),
177 + 'size_units' => [ 'px', '%' ],
178 + 'range' => [
179 + 'px' => [
180 + 'min' => 0,
181 + 'max' => 1500,
182 + 'step' => 1,
183 + ],
184 + '%' => [
185 + 'min' => 0,
186 + 'max' => 100,
187 + 'step' => 1,
188 + ],
189 + ],
190 + 'description' => esc_html__( 'Please select the element height.', 'shopbuilder' ),
191 + 'selectors' => [
192 + $obj->selectors['category_single_layout']['cat_height'] => 'height: {{SIZE}}{{UNIT}};',
193 + ],
194 + ];
195 +
196 + $fields['layout_section_end'] = $obj->end_section();
197 +
198 + return apply_filters( 'rtsb/elements/elementor/cat_layout_control', $fields, $obj );
199 + }
200 +
201 + /**
202 + * Columns section
203 + *
204 + * @param object $obj Reference object.
205 + * @return array
206 + */
207 + public static function columns( $obj ) {
208 + $fields['columns_section'] = $obj->start_section(
209 + esc_html__( 'Columns', 'shopbuilder' ),
210 + self::$tab
211 + );
212 +
213 + $fields['cols'] = [
214 + 'type' => 'select2',
215 + 'mode' => 'responsive',
216 + 'label' => esc_html__( 'Number of Columns', 'shopbuilder' ),
217 + 'description' => esc_html__( 'Please select the number of columns to show per row.', 'shopbuilder' ),
218 + 'options' => ControlHelper::layout_columns(),
219 + 'label_block' => true,
220 + 'default' => '0',
221 + 'tablet_default' => '0',
222 + 'mobile_default' => '0',
223 + 'required' => true,
224 + 'separator' => 'default',
225 + ];
226 +
227 + $fields['grid_gap'] = [
228 + 'type' => 'slider',
229 + 'mode' => 'responsive',
230 + 'label' => esc_html__( 'Grid Gap / Spacing (px)', 'shopbuilder' ),
231 + 'size_units' => [ 'px' ],
232 + 'range' => [
233 + 'px' => [
234 + 'min' => 0,
235 + 'max' => 100,
236 + 'step' => 1,
237 + ],
238 + ],
239 + 'default' => [
240 + 'unit' => 'px',
241 + 'size' => 30,
242 + ],
243 + 'description' => esc_html__( 'Please select the grid gap in px.', 'shopbuilder' ),
244 + 'selectors' => [
245 + $obj->selectors['columns']['grid_gap']['padding'] => 'padding-left: calc({{SIZE}}{{UNIT}} / 2); padding-right: calc({{SIZE}}{{UNIT}} / 2);',
246 + $obj->selectors['columns']['grid_gap']['margin'] => 'margin-left: calc(-{{SIZE}}{{UNIT}} / 2); margin-right: calc(-{{SIZE}}{{UNIT}} / 2);',
247 + ],
248 + 'condition' => [ 'cols!' => [ '1' ] ],
249 + ];
250 +
251 + $fields['image_width'] = [
252 + 'type' => 'slider',
253 + 'mode' => 'responsive',
254 + 'label' => esc_html__( 'Image Width (%)', 'shopbuilder' ),
255 + 'size_units' => [ 'px' ],
256 + 'range' => [
257 + '%' => [
258 + 'min' => 0,
259 + 'max' => 100,
260 + 'step' => 1,
261 + ],
262 + ],
263 + 'default' => [
264 + 'unit' => '%',
265 + 'size' => 32,
266 + ],
267 + 'description' => esc_html__( 'Please select the image width in %.', 'shopbuilder' ),
268 + 'selectors' => [
269 + $obj->selectors['columns']['image_width'] => 'flex-basis: {{SIZE}}{{UNIT}}; max-width: {{SIZE}}{{UNIT}};',
270 + ],
271 + 'condition' => [ 'layout' => [ 'list-layout1', 'list-layout2' ] ],
272 + ];
273 +
274 + $fields['image_gap'] = [
275 + 'type' => 'slider',
276 + 'mode' => 'responsive',
277 + 'label' => esc_html__( 'Image Gap (px)', 'shopbuilder' ),
278 + 'size_units' => [ 'px' ],
279 + 'range' => [
280 + 'px' => [
281 + 'min' => 0,
282 + 'max' => 100,
283 + 'step' => 1,
284 + ],
285 + ],
286 + 'default' => [
287 + 'unit' => 'px',
288 + 'size' => 30,
289 + ],
290 + 'description' => esc_html__( 'Please select the image gap in px.', 'shopbuilder' ),
291 + 'selectors' => [
292 + $obj->selectors['columns']['image_gap'] => 'gap: {{SIZE}}{{UNIT}};',
293 + ],
294 + 'condition' => [ 'layout' => [ 'list-layout1', 'list-layout2' ] ],
295 + ];
296 +
297 + $fields['grid_alignment'] = [
298 + 'mode' => 'responsive',
299 + 'type' => 'choose',
300 + 'label' => esc_html__( 'Elements Alignment', 'shopbuilder' ),
301 + 'options' => [
302 + 'left' => [
303 + 'title' => esc_html__( 'Left', 'shopbuilder' ),
304 + 'icon' => 'eicon-text-align-left',
305 + ],
306 + 'center' => [
307 + 'title' => esc_html__( 'Center', 'shopbuilder' ),
308 + 'icon' => 'eicon-text-align-center',
309 + ],
310 + 'right' => [
311 + 'title' => esc_html__( 'Right', 'shopbuilder' ),
312 + 'icon' => 'eicon-text-align-right',
313 + ],
314 + ],
315 + 'separator' => 'before-short elementor-control-separator-after',
316 + 'selectors' => [
317 + $obj->selectors['columns']['grid_alignment']['text_align'] => 'text-align: {{VALUE}};',
318 + $obj->selectors['columns']['grid_alignment']['justify_content'] => 'justify-content: {{VALUE}};',
319 + ],
320 + ];
321 + /*
322 + $fields['grid_style'] = [
323 + 'type' => 'select2',
324 + 'label' => esc_html__( 'Grid Style', 'shopbuilder' ),
325 + 'options' => [
326 + 'even' => esc_html__( 'Even', 'shopbuilder' ),
327 + 'masonry' => esc_html__( 'Masonry', 'shopbuilder' ),
328 + 'equal' => esc_html__( 'Equal Height', 'shopbuilder' ),
329 + ],
330 + 'label_block' => true,
331 + 'default' => 'even',
332 + 'description' => esc_html__( 'Please select the grid style.', 'shopbuilder' ),
333 + 'classes' => $obj->pro_class(),
334 + 'separator' => 'default',
335 + ];
336 + */
337 + $fields['columns_section_end'] = $obj->end_section();
338 +
339 + return apply_filters( 'rtsb/elements/elementor/columns_control', $fields, $obj );
340 + }
341 +
342 + /**
343 + * Slider Columns section
344 + *
345 + * @param object $obj Reference object.
346 + * @return array
347 + */
348 + public static function slider_columns( $obj ) {
349 + $fields['columns_section'] = $obj->start_section(
350 + esc_html__( 'Columns', 'shopbuilder' ),
351 + self::$tab
352 + );
353 +
354 + $fields['cols'] = [
355 + 'type' => 'select2',
356 + 'mode' => 'responsive',
357 + 'label' => esc_html__( 'Number of Slides Per View', 'shopbuilder' ),
358 + 'description' => esc_html__( 'Please select the number of slides to show per view.', 'shopbuilder' ),
359 + 'options' => ControlHelper::layout_columns(),
360 + 'label_block' => true,
361 + 'default' => '0',
362 + 'tablet_default' => '0',
363 + 'mobile_default' => '0',
364 + 'required' => true,
365 + 'separator' => 'default elementor-control-separator-after',
366 + ];
367 +
368 + $fields['cols_group'] = [
369 + 'type' => 'select2',
370 + 'mode' => 'responsive',
371 + 'label' => esc_html__( 'Number of Slides Per Group', 'shopbuilder' ),
372 + 'description' => esc_html__( 'Please select the number of slides to show per group.', 'shopbuilder' ),
373 + 'options' => ControlHelper::layout_columns(),
374 + 'label_block' => true,
375 + 'default' => '0',
376 + 'tablet_default' => '0',
377 + 'mobile_default' => '0',
378 + 'required' => true,
379 + 'separator' => 'default',
380 + 'classes' => $obj->pro_class(),
381 + ];
382 +
383 + $fields['grid_gap'] = [
384 + 'type' => 'slider',
385 + 'mode' => 'responsive',
386 + 'label' => esc_html__( 'Space Between Slides (px)', 'shopbuilder' ),
387 + 'size_units' => [ 'px' ],
388 + 'range' => [
389 + 'px' => [
390 + 'min' => 0,
391 + 'max' => 100,
392 + 'step' => 1,
393 + ],
394 + ],
395 + 'default' => [
396 + 'unit' => 'px',
397 + 'size' => 30,
398 + ],
399 + 'description' => esc_html__( 'Please select the space Between slides in px.', 'shopbuilder' ),
400 + ];
401 +
402 + $fields['grid_alignment'] = [
403 + 'mode' => 'responsive',
404 + 'type' => 'choose',
405 + 'label' => esc_html__( 'Elements Alignment', 'shopbuilder' ),
406 + 'options' => [
407 + 'left' => [
408 + 'title' => esc_html__( 'Left', 'shopbuilder' ),
409 + 'icon' => 'eicon-text-align-left',
410 + ],
411 + 'center' => [
412 + 'title' => esc_html__( 'Center', 'shopbuilder' ),
413 + 'icon' => 'eicon-text-align-center',
414 + ],
415 + 'right' => [
416 + 'title' => esc_html__( 'Right', 'shopbuilder' ),
417 + 'icon' => 'eicon-text-align-right',
418 + ],
419 + ],
420 + 'separator' => 'before-short elementor-control-separator-after',
421 + 'selectors' => [
422 + $obj->selectors['columns']['grid_alignment']['text_align'] => 'text-align: {{VALUE}};',
423 + $obj->selectors['columns']['grid_alignment']['justify_content'] => 'justify-content: {{VALUE}};',
424 + ],
425 + ];
426 +
427 + $fields['columns_section_end'] = $obj->end_section();
428 +
429 + return apply_filters( 'rtsb/elements/elementor/columns_control', $fields, $obj );
430 + }
431 +
432 + /**
433 + * Query section
434 + *
435 + * @param object $obj Reference object.
436 + * @return array
437 + */
438 + public static function query( $obj ) {
439 + $fields['query_section'] = $obj->start_section(
440 + esc_html__( 'Query', 'shopbuilder' ),
441 + self::$tab
442 + );
443 +
444 + $fields['query_note'] = $obj->el_heading( esc_html__( 'Common Filters', 'shopbuilder' ), 'default' );
445 +
446 + $fields['query_tabs'] = $obj->start_tab_group();
447 + $fields['include_tab'] = $obj->start_tab( esc_html__( 'Include', 'shopbuilder' ) );
448 +
449 + $fields['include_posts'] = [
450 + 'type' => 'select2',
451 + 'label' => esc_html__( 'Include Products', 'shopbuilder' ),
452 + 'options' => Fns::get_products_list(),
453 + 'description' => esc_html__( 'Please select the products to show. Leave it blank to include all products.', 'shopbuilder' ),
454 + 'multiple' => true,
455 + 'label_block' => true,
456 + 'separator' => 'default',
457 + ];
458 +
459 + $fields['include_tab_end'] = $obj->end_tab();
460 + $fields['exclude_tab'] = $obj->start_tab( esc_html__( 'Exclude', 'shopbuilder' ) );
461 +
462 + $fields['exclude_posts'] = [
463 + 'type' => 'select2',
464 + 'label' => esc_html__( 'Exclude Products', 'shopbuilder' ),
465 + 'options' => Fns::get_products_list(),
466 + 'description' => esc_html__( 'Please select the products to show. Leave it blank to exclude none.', 'shopbuilder' ),
467 + 'multiple' => true,
468 + 'label_block' => true,
469 + 'separator' => 'default',
470 + ];
471 +
472 + $fields['exclude_tab_end'] = $obj->end_tab();
473 + $fields['query_tabs_end'] = $obj->end_tab_group();
474 +
475 + $fields['posts_limit'] = [
476 + 'type' => 'number',
477 + 'label' => esc_html__( 'Products Limit', 'shopbuilder' ),
478 + 'description' => esc_html__( 'The number of products to show. Set empty to show all products.', 'shopbuilder' ),
479 + 'default' => 12,
480 + ];
481 +
482 + $fields['posts_offset'] = [
483 + 'type' => 'number',
484 + 'label' => esc_html__( 'Products Offset', 'shopbuilder' ),
485 + 'description' => esc_html__( 'Number of products to skip.', 'shopbuilder' ),
486 + ];
487 +
488 + $fields['category_note'] = $obj->el_heading( esc_html__( 'Taxonomy Filters', 'shopbuilder' ), 'before' );
489 +
490 + $fields['filter_categories'] = [
491 + 'type' => 'select2',
492 + 'label' => esc_html__( 'Filter By Categories', 'shopbuilder' ),
493 + 'options' => Fns::get_all_terms( 'product_cat' ),
494 + 'description' => esc_html__( 'Select the categories you want to filter, Leave it blank for all categories.', 'shopbuilder' ),
495 + 'multiple' => true,
496 + 'label_block' => true,
497 + 'separator' => 'default',
498 + ];
499 +
500 + $fields['filter_tags'] = [
501 + 'type' => 'select2',
502 + 'label' => esc_html__( 'Filter By Tags', 'shopbuilder' ),
503 + 'options' => Fns::get_all_terms( 'product_tag' ),
504 + 'description' => esc_html__( 'Select the tags you want to filter, Leave it blank for all tags.', 'shopbuilder' ),
505 + 'multiple' => true,
506 + 'label_block' => true,
507 + ];
508 +
509 + $fields['filter_attributes'] = [
510 + 'type' => 'select2',
511 + 'label' => esc_html__( 'Filter By Attributes', 'shopbuilder' ),
512 + 'options' => Fns::get_all_attributes(),
513 + 'description' => esc_html__( 'Select the attributes you want to filter, Leave it blank for all attributes.', 'shopbuilder' ),
514 + 'multiple' => true,
515 + 'label_block' => true,
516 + ];
517 +
518 + $fields['tax_relation'] = [
519 + 'type' => 'select2',
520 + 'label' => esc_html__( 'Taxonomy relation', 'shopbuilder' ),
521 + 'options' => [
522 + 'OR' => 'Show All Products (OR)',
523 + 'AND' => 'Show Common Products (AND)',
524 + ],
525 + 'default' => 'OR',
526 + 'description' => esc_html__( 'Select the taxonomies relationship. It is applicable if you select more than one taxonomy.', 'shopbuilder' ),
527 + 'label_block' => true,
528 + ];
529 +
530 + $fields['advanced_note'] = $obj->el_heading( esc_html__( 'Advanced Filters', 'shopbuilder' ), 'before' );
531 +
532 + $fields['filter_author'] = [
533 + 'type' => 'select2',
534 + 'label' => esc_html__( 'Filter By Author', 'shopbuilder' ),
535 + 'options' => Fns::get_users(),
536 + 'description' => esc_html__( 'Select the author you want to filter, Leave it blank for all author.', 'shopbuilder' ),
537 + 'multiple' => true,
538 + 'label_block' => true,
539 + 'separator' => 'default elementor-control-separator-after',
540 + ];
541 +
542 + $fields['products_filter'] = [
543 + 'type' => 'select2',
544 + 'label' => esc_html__( 'Display Products By:', 'shopbuilder' ),
545 + 'options' => ControlHelper::filter_products(),
546 + 'default' => 'best-selling',
547 + 'description' => esc_html__( 'Please select the conditional display of products.', 'shopbuilder' ),
548 + 'label_block' => true,
549 + 'classes' => $obj->pro_class(),
550 + 'separator' => 'default',
551 + ];
552 +
553 + $fields['sorting_note'] = $obj->el_heading( esc_html__( 'Sorting', 'shopbuilder' ), 'before' );
554 +
555 + $fields['posts_order_by'] = [
556 + 'type' => 'select2',
557 + 'label' => esc_html__( 'Order By', 'shopbuilder' ),
558 + 'description' => esc_html__( 'Please choose to reorder products.', 'shopbuilder' ),
559 + 'options' => ControlHelper::posts_order_by(),
560 + 'default' => 'date',
561 + 'separator' => 'default',
562 + ];
563 +
564 + $fields['posts_order'] = [
565 + 'type' => 'select2',
566 + 'label' => esc_html__( 'Order', 'shopbuilder' ),
567 + 'description' => esc_html__( 'Please choose to reorder products.', 'shopbuilder' ),
568 + 'options' => ControlHelper::posts_order(),
569 + 'default' => 'DESC',
570 + ];
571 +
572 + $fields['query_section_end'] = $obj->end_section();
573 +
574 + return apply_filters( 'rtsb/elements/elementor/query_control', $fields, $obj );
575 + }
576 +
577 + /**
578 + * Query section
579 + *
580 + * @param object $obj Reference object.
581 + * @return array
582 + */
583 + public static function additional_query( $obj ) {
584 + $fields['query_section'] = $obj->start_section(
585 + esc_html__( 'Query', 'shopbuilder' ),
586 + self::$tab
587 + );
588 +
589 + $fields['query_note'] = $obj->el_heading( esc_html__( 'Common Filters', 'shopbuilder' ), 'default' );
590 +
591 + $fields['posts_limit'] = [
592 + 'type' => 'number',
593 + 'label' => esc_html__( 'Products Limit', 'shopbuilder' ),
594 + 'description' => esc_html__( 'The number of products to show. Set empty to show all products.', 'shopbuilder' ),
595 + 'default' => 12,
596 + ];
597 +
598 + $fields['sorting_note'] = $obj->el_heading( esc_html__( 'Sorting', 'shopbuilder' ), 'before' );
599 +
600 + $fields['posts_order_by'] = [
601 + 'type' => 'select2',
602 + 'label' => esc_html__( 'Order By', 'shopbuilder' ),
603 + 'description' => esc_html__( 'Please choose to reorder products.', 'shopbuilder' ),
604 + 'options' => ControlHelper::posts_order_by(),
605 + 'default' => 'date',
606 + 'separator' => 'default',
607 + ];
608 +
609 + $fields['posts_order'] = [
610 + 'type' => 'select2',
611 + 'label' => esc_html__( 'Order', 'shopbuilder' ),
612 + 'description' => esc_html__( 'Please choose to reorder products.', 'shopbuilder' ),
613 + 'options' => ControlHelper::posts_order(),
614 + 'default' => 'DESC',
615 + ];
616 +
617 + $fields['query_section_end'] = $obj->end_section();
618 +
619 + return apply_filters( 'rtsb/elements/elementor/query_control', $fields, $obj );
620 + }
621 +
622 + /**
623 + * Category Query section
624 + *
625 + * @param object $obj Reference object.
626 + * @return array
627 + */
628 + public static function cat_single_query( $obj ) {
629 + $fields['query_section'] = $obj->start_section(
630 + esc_html__( 'Query', 'shopbuilder' ),
631 + self::$tab
632 + );
633 +
634 + $fields['select_source'] = [
635 + 'type' => 'select2',
636 + 'label' => esc_html__( 'Select Taxonomy', 'shopbuilder' ),
637 + 'options' => Fns::get_tax_list(),
638 + 'description' => esc_html__( 'Please select the taxonomy.', 'shopbuilder' ),
639 + 'label_block' => true,
640 + 'default' => 'product_cat',
641 + 'separator' => 'default',
642 + ];
643 +
644 + $fields['select_cat'] = [
645 + 'type' => 'select2',
646 + 'label' => esc_html__( 'Choose Category', 'shopbuilder' ),
647 + 'options' => Fns::get_terms( 'product_cat' ),
648 + 'description' => esc_html__( 'Please select the category to show.', 'shopbuilder' ),
649 + 'label_block' => true,
650 + 'default' => Fns::get_terms( 'product_cat', true ),
651 + 'condition' => [
652 + 'select_source' => [ 'product_cat' ],
653 + ],
654 + ];
655 +
656 + $fields['select_tag'] = [
657 + 'type' => 'select2',
658 + 'label' => esc_html__( 'Choose Tag', 'shopbuilder' ),
659 + 'options' => Fns::get_terms( 'product_tag' ),
660 + 'description' => esc_html__( 'Please select the tag to show.', 'shopbuilder' ),
661 + 'label_block' => true,
662 + 'default' => Fns::get_terms( 'product_tag', true ),
663 + 'condition' => [
664 + 'select_source' => [ 'product_tag' ],
665 + ],
666 + ];
667 +
668 + $fields['query_section_end'] = $obj->end_section();
669 +
670 + return apply_filters( 'rtsb/elements/elementor/cat_single_query_control', $fields, $obj );
671 + }
672 +
673 + /**
674 + * Category Query section
675 + *
676 + * @param object $obj Reference object.
677 + * @return array
678 + */
679 + public static function cat_query( $obj ) {
680 + $fields['query_section'] = $obj->start_section(
681 + esc_html__( 'Query', 'shopbuilder' ),
682 + self::$tab
683 + );
684 +
685 + $fields['query_note'] = $obj->el_heading( esc_html__( 'Filter', 'shopbuilder' ), 'default' );
686 +
687 + $fields['display_cat_by'] = [
688 + 'type' => 'select2',
689 + 'label' => esc_html__( 'Display Categories By:', 'shopbuilder' ),
690 + 'options' => Fns::get_cat_list(),
691 + 'description' => esc_html__( 'Please select what categories will be displayed.', 'shopbuilder' ),
692 + 'label_block' => true,
693 + 'default' => 'all',
694 + 'separator' => 'default',
695 + ];
696 +
697 + $fields['select_parent_cat'] = [
698 + 'type' => 'select2',
699 + 'label' => esc_html__( 'Select Parent Category', 'shopbuilder' ),
700 + 'options' => Fns::get_terms( 'product_cat', false, true ),
701 + 'description' => esc_html__( 'Please select the parent category to show.', 'shopbuilder' ),
702 + 'label_block' => true,
703 + 'default' => Fns::get_terms( 'product_cat', true, true ),
704 + 'condition' => [ 'display_cat_by' => [ 'specific_parent' ] ],
705 + ];
706 +
707 + $fields['include_cats'] = [
708 + 'type' => 'select2',
709 + 'label' => esc_html__( 'Select Categories', 'shopbuilder' ),
710 + 'options' => Fns::get_terms( 'product_cat' ),
711 + 'description' => esc_html__( 'Please select the categories to show.', 'shopbuilder' ),
712 + 'label_block' => true,
713 + 'multiple' => true,
714 + 'condition' => [ 'display_cat_by' => [ 'selection' ] ],
715 + ];
716 +
717 + $fields['include_cat_ids'] = [
718 + 'type' => 'text',
719 + 'label' => esc_html__( 'Enter Category IDs', 'shopbuilder' ),
720 + 'description' => esc_html__( 'Please enter the category IDs separated by comma.', 'shopbuilder' ),
721 + 'label_block' => true,
722 + 'condition' => [ 'display_cat_by' => [ 'cat_ids' ] ],
723 + ];
724 +
725 + $fields['exclude_cats'] = [
726 + 'type' => 'select2',
727 + 'label' => esc_html__( 'Exclude Categories', 'shopbuilder' ),
728 + 'options' => Fns::get_terms( 'product_cat' ),
729 + 'description' => esc_html__( 'Please select the categories to exclude. Leave it blank to exclude none.', 'shopbuilder' ),
730 + 'multiple' => true,
731 + 'label_block' => true,
732 + 'condition' => [ 'display_cat_by' => [ 'all' ] ],
733 + ];
734 +
735 + $fields['cats_limit'] = [
736 + 'type' => 'number',
737 + 'label' => esc_html__( 'Categories Limit', 'shopbuilder' ),
738 + 'description' => esc_html__( 'The number of categories to show. Set empty to show all categories.', 'shopbuilder' ),
739 + 'condition' => [ 'display_cat_by!' => [ 'selection' ] ],
740 + ];
741 +
742 + $fields['show_top_level_cats'] = [
743 + 'type' => 'switch',
744 + 'label' => __( 'Show only Top Level <br /> Sub-Categories?', 'shopbuilder' ),
745 + 'description' => esc_html__( 'Switch on to display only first level sub-categories.', 'shopbuilder' ),
746 + 'label_on' => esc_html__( 'On', 'shopbuilder' ),
747 + 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
748 + 'condition' => [ 'display_cat_by' => [ 'specific_parent' ] ],
749 + ];
750 +
751 + $fields['show_empty'] = [
752 + 'type' => 'switch',
753 + 'label' => esc_html__( 'Show Empty Categories?', 'shopbuilder' ),
754 + 'description' => esc_html__( 'Switch on to display empty categories.', 'shopbuilder' ),
755 + 'label_on' => esc_html__( 'On', 'shopbuilder' ),
756 + 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
757 + 'default' => 'yes',
758 + ];
759 +
760 + $fields['show_uncategorized'] = [
761 + 'type' => 'switch',
762 + 'label' => __( 'Show Uncategorized <br />(Or Default Category)?', 'shopbuilder' ),
763 + 'description' => esc_html__( 'Switch on to display uncategorized.', 'shopbuilder' ),
764 + 'label_on' => esc_html__( 'On', 'shopbuilder' ),
765 + 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
766 + 'default' => 'yes',
767 + 'condition' => [ 'display_cat_by' => [ 'all' ] ],
768 + ];
769 +
770 + $fields['show_subcats'] = [
771 + 'type' => 'switch',
772 + 'label' => esc_html__( 'Show Sub-Categories?', 'shopbuilder' ),
773 + 'description' => esc_html__( 'Switch on to display subcategories.', 'shopbuilder' ),
774 + 'label_on' => esc_html__( 'On', 'shopbuilder' ),
775 + 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
776 + 'default' => 'yes',
777 + 'condition' => [ 'display_cat_by' => [ 'all' ] ],
778 + ];
779 +
780 + $fields['sorting_note'] = $obj->el_heading( esc_html__( 'Sorting', 'shopbuilder' ), 'before' );
781 +
782 + $fields['cats_order_by'] = [
783 + 'type' => 'select2',
784 + 'label' => esc_html__( 'Order By', 'shopbuilder' ),
785 + 'description' => esc_html__( 'Please choose to reorder categories.', 'shopbuilder' ),
786 + 'options' => ControlHelper::cats_order_by(),
787 + 'default' => 'name',
788 + 'separator' => 'default',
789 + ];
790 +
791 + $fields['cats_order'] = [
792 + 'type' => 'select2',
793 + 'label' => esc_html__( 'Order', 'shopbuilder' ),
794 + 'description' => esc_html__( 'Please choose to reorder categories.', 'shopbuilder' ),
795 + 'options' => ControlHelper::posts_order(),
796 + 'default' => 'ASC',
797 + ];
798 +
799 + $fields['query_section_end'] = $obj->end_section();
800 +
801 + return apply_filters( 'rtsb/elements/elementor/cat_query_control', $fields, $obj );
802 + }
803 +
804 + /**
805 + * Pagination section
806 + *
807 + * @param object $obj Reference object.
808 + * @return array
809 + */
810 + public static function pagination( $obj ) {
811 + $fields['pagination_section'] = $obj->start_section(
812 + esc_html__( 'Pagination', 'shopbuilder' ),
813 + self::$tab
814 + );
815 +
816 + $fields['show_pagination'] = [
817 + 'type' => 'switch',
818 + 'label' => esc_html__( 'Enable Pagination?', 'shopbuilder' ),
819 + 'description' => esc_html__( 'Switch on to enable pagination.', 'shopbuilder' ),
820 + 'label_on' => esc_html__( 'On', 'shopbuilder' ),
821 + 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
822 + 'separator' => 'default',
823 + ];
824 +
825 + $fields['pagination_per_page'] = [
826 + 'type' => 'number',
827 + 'label' => esc_html__( 'Number of Posts Per Page', 'shopbuilder' ),
828 + 'default' => 8,
829 + 'description' => esc_html__( 'Please enter the number of team members per page to show.', 'shopbuilder' ),
830 + 'condition' => [ 'show_pagination' => [ 'yes' ] ],
831 + ];
832 +
833 + $fields['pagination_type'] = [
834 + 'type' => 'select2',
835 + 'label' => esc_html__( 'Pagination Type', 'shopbuilder' ),
836 + // TODO: Will be activated later.
837 + // 'description' => __( 'Please choose the pagination type.<span class="elementor-pro-notice"><a target="_blank" href="' . esc_url( rtsb()->pro_version_link() ) . '">Upgrade to PRO</a> to unlock Load More and Ajax Pagination.</span>', 'shopbuilder' ),
838 + 'description' => __( 'Please choose the pagination type.', 'shopbuilder' ),
839 + 'options' => [
840 + 'pagination' => esc_html__( 'Number Pagination', 'shopbuilder' ),
841 + ],
842 + 'default' => 'pagination',
843 + 'label_block' => true,
844 + 'condition' => [ 'show_pagination' => [ 'yes' ] ],
845 + ];
846 +
847 + $fields['pagination_section_end'] = $obj->end_section();
848 +
849 + return apply_filters( 'rtsb/elements/elementor/pagination_control', $fields, $obj );
850 + }
851 +
852 + /**
853 + * Image section
854 + *
855 + * @param object $obj Reference object.
856 + * @return array
857 + */
858 + public static function image( $obj ) {
859 + $fields['image_section'] = $obj->start_section(
860 + esc_html__( 'Image', 'shopbuilder' ),
861 + self::$tab
862 + );
863 +
864 + $fields['show_featured_image'] = [
865 + 'type' => 'switch',
866 + 'label' => esc_html__( 'Display Featured Image?', 'shopbuilder' ),
867 + 'description' => esc_html__( 'Switch on to display featured image.', 'shopbuilder' ),
868 + 'label_on' => esc_html__( 'On', 'shopbuilder' ),
869 + 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
870 + 'default' => 'yes',
871 + 'separator' => 'default',
872 + ];
873 +
874 + $fields['show_hover_image'] = [
875 + 'type' => 'switch',
876 + 'label' => __( 'Display Gallery Image <br />on Hover?', 'shopbuilder' ),
877 + 'description' => __( 'Switch on to display gallery image on hover. <br /><b>Note: </b>It will display the first gallery image on hover.', 'shopbuilder' ),
878 + 'label_on' => esc_html__( 'On', 'shopbuilder' ),
879 + 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
880 + 'default' => 'yes',
881 + 'condition' => [ 'show_featured_image' => [ 'yes' ] ],
882 + ];
883 +
884 + if ( function_exists( 'rtwpvsp' ) ) {
885 + $fields['show_hover_image']['condition'] = [
886 + 'show_featured_image' => [ 'yes' ],
887 + 'show_swatches' => [ '' ],
888 + ];
889 + }
890 +
891 + $fields['image_hover_animation'] = [
892 + 'type' => 'select2',
893 + 'label' => esc_html__( 'Image Hover Animation', 'shopbuilder' ),
894 + 'description' => esc_html__( 'Please choose image hover animation.', 'shopbuilder' ),
895 + 'options' => [
896 + 'zoom_in' => esc_html__( 'Zoom In', 'shopbuilder' ),
897 + 'zoom_out' => esc_html__( 'Zoom Out', 'shopbuilder' ),
898 + 'none' => esc_html__( 'None', 'shopbuilder' ),
899 + ],
900 + 'label_block' => true,
901 + 'condition' => [ 'show_featured_image' => [ 'yes' ] ],
902 + 'default' => 'zoom_in',
903 + ];
904 +
905 + $fields = array_merge( $fields, self::image_size_controls( 'grid' ) );
906 +
907 + $fields['image_section_end'] = $obj->end_section();
908 +
909 + return apply_filters( 'rtsb/elements/elementor/image_control', $fields, $obj );
910 + }
911 +
912 + /**
913 + * Category Image section
914 + *
915 + * @param object $obj Reference object.
916 + * @return array
917 + */
918 + public static function cat_image( $obj ) {
919 + $fields['cat_image_section'] = $obj->start_section(
920 + esc_html__( 'Image', 'shopbuilder' ),
921 + self::$tab
922 + );
923 +
924 + $fields['show_cat_image'] = [
925 + 'type' => 'switch',
926 + 'label' => esc_html__( 'Display Category Image?', 'shopbuilder' ),
927 + 'description' => esc_html__( 'Switch on to display category image.', 'shopbuilder' ),
928 + 'label_on' => esc_html__( 'On', 'shopbuilder' ),
929 + 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
930 + 'default' => 'yes',
931 + 'separator' => 'default',
932 + ];
933 +
934 + $fields['show_custom_image'] = [
935 + 'type' => 'switch',
936 + 'label' => esc_html__( 'Add Custom Image?', 'shopbuilder' ),
937 + 'description' => esc_html__( 'Switch on to select a custom category image. Setting a custom image will override the category image.', 'shopbuilder' ),
938 + 'label_on' => esc_html__( 'On', 'shopbuilder' ),
939 + 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
940 + 'classes' => $obj->pro_class(),
941 + 'separator' => 'default',
942 + 'condition' => [ 'layout' => [ 'category-single-layout1' ] ],
943 + ];
944 +
945 + $fields['custom_image'] = [
946 + 'type' => 'media',
947 + 'label' => esc_html__( 'Upload Custom Image', 'shopbuilder' ),
948 + 'description' => esc_html__( 'Please choose the custom category image.', 'shopbuilder' ),
949 + 'label_on' => esc_html__( 'On', 'shopbuilder' ),
950 + 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
951 + 'condition' => [ 'show_custom_image' => [ 'yes' ] ],
952 + 'default' => [
953 + 'url' => \Elementor\Utils::get_placeholder_image_src(),
954 + ],
955 + ];
956 +
957 + $fields['show_overlay'] = [
958 + 'type' => 'switch',
959 + 'label' => esc_html__( 'Enable Image Overlay?', 'shopbuilder' ),
960 + 'description' => esc_html__( 'Switch on to enable image overlay.', 'shopbuilder' ),
961 + 'label_on' => esc_html__( 'On', 'shopbuilder' ),
962 + 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
963 + 'condition' => [
964 + 'layout' => [ 'category-single-layout1' ],
965 + ],
966 + ];
967 +
968 + $fields['show_custom_icon'] = [
969 + 'type' => 'switch',
970 + 'label' => esc_html__( 'Enable Custom Icons?', 'shopbuilder' ),
971 + 'description' => esc_html__( 'Switch on to enable custom icons instead of category images.', 'shopbuilder' ),
972 + 'label_on' => esc_html__( 'On', 'shopbuilder' ),
973 + 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
974 + 'condition' => [ 'layout!' => [ 'category-single-layout1' ] ],
975 + 'classes' => $obj->pro_class(),
976 + 'separator' => 'default',
977 + ];
978 +
979 + $all_categories = Fns::get_terms( 'product_cat', false, false, true );
980 +
981 + foreach ( $all_categories as $cat_id => $category ) {
982 + $fields[ 'custom_icon_' . $cat_id ] = [
983 + 'type' => 'icons',
984 + 'label' => sprintf(
985 + /* translators: Category name */
986 + __( 'Choose Icon for Category: %s', 'shopbuilder' ),
987 + esc_html( $category )
988 + ),
989 + 'condition' => [
990 + 'show_custom_icon' => [ 'yes' ],
991 + 'layout!' => [ 'category-single-layout1' ],
992 + ],
993 + ];
994 + }
995 +
996 + $fields = array_merge( $fields, self::image_size_controls( 'catgory' ) );
997 +
998 + $fields['cat_image_section_end'] = $obj->end_section();
999 +
1000 + return apply_filters( 'rtsb/elements/elementor/cat_image_control', $fields, $obj );
1001 + }
1002 +
1003 + /**
1004 + * Image Size Controls.
1005 + *
1006 + * @param string $type Type.
1007 + * @return array
1008 + */
1009 + private static function image_size_controls( $type ) {
1010 + $conditions = [
1011 + 'relation' => 'and',
1012 + 'terms' => [],
1013 + ];
1014 +
1015 + if ( 'grid' === $type ) {
1016 + $conditions['terms'][] = [
1017 + 'relation' => 'or',
1018 + 'terms' => [
1019 + [
1020 + 'name' => 'show_featured_image',
1021 + 'operator' => '==',
1022 + 'value' => 'yes',
1023 + ],
1024 + ],
1025 + ];
1026 + } else {
1027 + $conditions['terms'][] = [
1028 + 'relation' => 'or',
1029 + 'terms' => [
1030 + [
1031 + 'name' => 'show_cat_image',
1032 + 'operator' => '==',
1033 + 'value' => 'yes',
1034 + ],
1035 + [
1036 + 'name' => 'show_custom_image',
1037 + 'operator' => '==',
1038 + 'value' => 'yes',
1039 + ],
1040 + ],
1041 + ];
1042 + }
1043 +
1044 + $fields['image'] = [
1045 + 'type' => 'select2',
1046 + 'label' => esc_html__( 'Select Image Size', 'shopbuilder' ),
1047 + 'description' => esc_html__( 'Please select the image size.', 'shopbuilder' ),
1048 + 'options' => Fns::get_image_sizes(),
1049 + 'default' => 'woocommerce_thumbnail',
1050 + 'label_block' => true,
1051 + 'content_classes' => 'elementor-descriptor',
1052 + 'conditions' => $conditions,
1053 + ];
1054 +
1055 + $conditions['terms'][] = [
1056 + 'relation' => 'or',
1057 + 'terms' => [
1058 + [
1059 + 'name' => 'image',
1060 + 'operator' => '==',
1061 + 'value' => 'rtsb_custom',
1062 + ],
1063 + ],
1064 + ];
1065 +
1066 + $fields['image_custom_dimension'] = [
1067 + 'type' => 'image-dimensions',
1068 + 'label' => esc_html__( 'Enter Custom Image Size', 'shopbuilder' ),
1069 + 'label_block' => true,
1070 + 'show_label' => true,
1071 + 'default' => [
1072 + 'width' => 400,
1073 + 'height' => 400,
1074 + ],
1075 + 'conditions' => $conditions,
1076 + ];
1077 +
1078 + $fields['image_crop'] = [
1079 + 'type' => 'select2',
1080 + 'label' => esc_html__( 'Image Crop', 'shopbuilder' ),
1081 + 'description' => esc_html__( 'Please click on "Apply" to update the image.', 'shopbuilder' ),
1082 + 'options' => [
1083 + 'soft' => esc_html__( 'Soft Crop', 'shopbuilder' ),
1084 + 'hard' => esc_html__( 'Hard Crop', 'shopbuilder' ),
1085 + ],
1086 + 'default' => 'hard',
1087 + 'conditions' => $conditions,
1088 + ];
1089 +
1090 + $fields['image_custom_dimension_note'] = [
1091 + 'type' => 'html',
1092 + 'raw' => sprintf(
1093 + '<span style="display: block; background: #fffbf1; padding: 10px; font-weight: 500; line-height: 1.4; color: #bd3a3a">%s</span>',
1094 + 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' )
1095 + ),
1096 + 'conditions' => $conditions,
1097 + 'separator' => 'after',
1098 + ];
1099 +
1100 + return $fields;
1101 + }
1102 +}