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