| 1 |
<?php |
| 2 |
|
| 3 |
namespace UltimateStoreKit\Modules\EddCategoryCarousel\Widgets; |
| 4 |
|
| 5 |
use UltimateStoreKit\Base\Module_Base; |
| 6 |
use Elementor\Controls_Manager; |
| 7 |
use Elementor\Utils; |
| 8 |
use Elementor\Group_Control_Border; |
| 9 |
use Elementor\Group_Control_Box_Shadow; |
| 10 |
use Elementor\Group_Control_Image_Size; |
| 11 |
use Elementor\Group_Control_Background; |
| 12 |
use Elementor\Group_Control_Typography; |
| 13 |
|
| 14 |
use UltimateStoreKit\Traits\Global_Terms_Query_Controls; |
| 15 |
use UltimateStoreKit\traits\Global_Widget_Controls; |
| 16 |
use UltimateStoreKit\traits\Global_Widget_Template; |
| 17 |
|
| 18 |
if (!defined('ABSPATH')) { |
| 19 |
exit; // Exit if accessed directly. |
| 20 |
} |
| 21 |
|
| 22 |
class EDD_Category_Carousel extends Module_Base { |
| 23 |
use Global_Widget_Controls; |
| 24 |
use Global_Terms_Query_Controls; |
| 25 |
use Global_Widget_Template; |
| 26 |
public function get_name() { |
| 27 |
return 'usk-edd-category-carousel'; |
| 28 |
} |
| 29 |
|
| 30 |
public function get_title() { |
| 31 |
return esc_html__('EDD Category Carousel', 'ultimate-store-kit'); |
| 32 |
} |
| 33 |
|
| 34 |
public function get_icon() { |
| 35 |
return 'usk-widget-icon usk-icon-edd-category-carousel'; |
| 36 |
} |
| 37 |
|
| 38 |
public function get_categories() { |
| 39 |
return ['ultimate-store-kit']; |
| 40 |
} |
| 41 |
|
| 42 |
public function get_keywords() { |
| 43 |
return ['easy', 'digital', 'category', 'downloads', 'eshop', 'estore', 'profile', 'editor']; |
| 44 |
} |
| 45 |
|
| 46 |
public function get_style_depends() { |
| 47 |
if ($this->usk_is_edit_mode()) { |
| 48 |
return ['usk-all-styles']; |
| 49 |
} else { |
| 50 |
return ['ultimate-store-kit-font', 'usk-edd-category-carousel']; |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
// public function get_script_depends() { |
| 55 |
// if ($this->usk_is_edit_mode()) { |
| 56 |
// return ['usk-scripts']; |
| 57 |
// } else { |
| 58 |
// return ['usk-edd-category-carousel']; |
| 59 |
// } |
| 60 |
// } |
| 61 |
|
| 62 |
public function get_custom_help_url() { |
| 63 |
return 'https://youtu.be/z6MSJtvbxPQ'; |
| 64 |
} |
| 65 |
|
| 66 |
protected function register_controls() { |
| 67 |
|
| 68 |
$this->start_controls_section( |
| 69 |
'section_content_layout', |
| 70 |
[ |
| 71 |
'label' => esc_html__('Layout', 'ultimate-store-kit'), |
| 72 |
] |
| 73 |
); |
| 74 |
|
| 75 |
$this->add_control( |
| 76 |
'skin_layout', |
| 77 |
[ |
| 78 |
'label' => __('Skin', 'ultimate-store-kit'), |
| 79 |
'type' => Controls_Manager::SELECT, |
| 80 |
'default' => 'style-1', |
| 81 |
'options' => [ |
| 82 |
'style-1' => __('Style 1', 'ultimate-store-kit'), |
| 83 |
'style-2' => __('Style 2', 'ultimate-store-kit'), |
| 84 |
'style-3' => __('Style 3', 'ultimate-store-kit'), |
| 85 |
'style-4' => __('Style 4', 'ultimate-store-kit'), |
| 86 |
'style-5' => __('Style 5', 'ultimate-store-kit'), |
| 87 |
|
| 88 |
// 'style-6' => __('Style 6', 'ultimate-store-kit'), |
| 89 |
], |
| 90 |
] |
| 91 |
); |
| 92 |
$this->add_responsive_control( |
| 93 |
'columns', |
| 94 |
[ |
| 95 |
'label' => __('Columns', 'ultimate-store-kit'), |
| 96 |
'type' => Controls_Manager::SELECT, |
| 97 |
'default' => 3, |
| 98 |
'tablet_default' => 2, |
| 99 |
'mobile_default' => 1, |
| 100 |
'options' => [ |
| 101 |
1 => '1', |
| 102 |
2 => '2', |
| 103 |
3 => '3', |
| 104 |
4 => '4', |
| 105 |
5 => '5', |
| 106 |
6 => '6', |
| 107 |
], |
| 108 |
] |
| 109 |
); |
| 110 |
$this->add_control( |
| 111 |
'alignment', |
| 112 |
[ |
| 113 |
'label' => __('Title', 'ultimate-store-kit'), |
| 114 |
'type' => Controls_Manager::HIDDEN, |
| 115 |
'default' => 'traditional', |
| 116 |
] |
| 117 |
); |
| 118 |
|
| 119 |
$this->add_responsive_control( |
| 120 |
'items_gap', |
| 121 |
[ |
| 122 |
'label' => __('Item Gap', 'ultimate-store-kit'), |
| 123 |
'type' => Controls_Manager::SLIDER, |
| 124 |
'default' => [ |
| 125 |
'size' => 20, |
| 126 |
], |
| 127 |
'selectors' => [ |
| 128 |
'{{WRAPPER}} .usk-edd-category-carousel' => 'grid-gap: {{SIZE}}{{UNIT}};', |
| 129 |
], |
| 130 |
] |
| 131 |
); |
| 132 |
|
| 133 |
$this->add_responsive_control( |
| 134 |
'item_height', |
| 135 |
[ |
| 136 |
'label' => esc_html__('Item Height(px)', 'ultimate-store-kit-pro'), |
| 137 |
'type' => Controls_Manager::SLIDER, |
| 138 |
'range' => [ |
| 139 |
'px' => [ |
| 140 |
'min' => 0, |
| 141 |
'max' => 1000, |
| 142 |
], |
| 143 |
], |
| 144 |
'selectors' => [ |
| 145 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item' => 'height: {{SIZE}}{{UNIT}};', |
| 146 |
'{{WRAPPER}} .usk-edd-category-carousel .usk-edd-category-carousel-image' => 'height: {{SIZE}}{{UNIT}};' |
| 147 |
], |
| 148 |
'condition' => [ |
| 149 |
'skin_layout!' => 'style-3' |
| 150 |
] |
| 151 |
] |
| 152 |
); |
| 153 |
$this->add_responsive_control( |
| 154 |
'item_height_skin_3', |
| 155 |
[ |
| 156 |
'label' => esc_html__('Item Height(px)', 'ultimate-store-kit-pro'), |
| 157 |
'type' => Controls_Manager::SLIDER, |
| 158 |
'range' => [ |
| 159 |
'px' => [ |
| 160 |
'min' => 0, |
| 161 |
'max' => 1000, |
| 162 |
], |
| 163 |
], |
| 164 |
'selectors' => [ |
| 165 |
'{{WRAPPER}} .usk-edd-category-carousel .usk-edd-category-carousel-image' => 'height: {{SIZE}}{{UNIT}};' |
| 166 |
], |
| 167 |
'condition' => [ |
| 168 |
'skin_layout' => 'style-3' |
| 169 |
] |
| 170 |
] |
| 171 |
); |
| 172 |
$this->add_control( |
| 173 |
'is_use_image', |
| 174 |
[ |
| 175 |
'label' => esc_html__('Use Static Image', 'ultimate-store-kit'), |
| 176 |
'type' => Controls_Manager::SWITCHER, |
| 177 |
'default' => 'yes', |
| 178 |
'suskarator' => 'before' |
| 179 |
] |
| 180 |
); |
| 181 |
$this->add_control( |
| 182 |
'category_image', |
| 183 |
[ |
| 184 |
'label' => __('Select Image', 'ultimate-store-kit'), |
| 185 |
'type' => Controls_Manager::MEDIA, |
| 186 |
'default' => [ |
| 187 |
'url' => Utils::get_placeholder_image_src(), |
| 188 |
], |
| 189 |
'condition' => [ |
| 190 |
'is_use_image' => 'yes' |
| 191 |
] |
| 192 |
] |
| 193 |
); |
| 194 |
|
| 195 |
$this->add_group_control( |
| 196 |
Group_Control_Image_Size::get_type(), |
| 197 |
[ |
| 198 |
'name' => 'category_thumbnail', |
| 199 |
'exclude' => ['custom'], |
| 200 |
'default' => 'medium', |
| 201 |
'condition' => [ |
| 202 |
'is_use_image' => 'yes' |
| 203 |
] |
| 204 |
] |
| 205 |
); |
| 206 |
$this->add_control( |
| 207 |
'show_count', |
| 208 |
[ |
| 209 |
'label' => esc_html__('Show Count', 'ultimate-store-kit'), |
| 210 |
'type' => Controls_Manager::SWITCHER, |
| 211 |
'default' => 'yes', |
| 212 |
// 'suskarator' => 'before' |
| 213 |
] |
| 214 |
); |
| 215 |
$this->end_controls_section(); |
| 216 |
$this->render_terms_query_controls('download_category'); |
| 217 |
// $this->register_global_controls_additional(); |
| 218 |
$this->register_global_controls_carousel_navigation(); |
| 219 |
$this->register_global_controls_carousel_settings(); |
| 220 |
|
| 221 |
$this->start_controls_section( |
| 222 |
'section_style_item', |
| 223 |
[ |
| 224 |
'label' => esc_html__('Item', 'ultimate-store-kit'), |
| 225 |
'tab' => Controls_Manager::TAB_STYLE, |
| 226 |
] |
| 227 |
); |
| 228 |
$this->start_controls_tabs( |
| 229 |
'item_tabs' |
| 230 |
); |
| 231 |
$this->start_controls_tab( |
| 232 |
'item_tab_normal', |
| 233 |
[ |
| 234 |
'label' => esc_html__('Normal', 'ultimate-store-kit'), |
| 235 |
] |
| 236 |
); |
| 237 |
$this->add_group_control( |
| 238 |
Group_Control_Background::get_type(), |
| 239 |
[ |
| 240 |
'name' => 'items_background', |
| 241 |
'label' => esc_html__('Backgrund', 'ultimate-store-kit'), |
| 242 |
'types' => ['classic', 'gradient'], |
| 243 |
'selector' => '{{WRAPPER}} .usk-edd-category-carousel .usk-edd-category-grid-image', |
| 244 |
] |
| 245 |
); |
| 246 |
$this->add_control( |
| 247 |
'item_overlay', |
| 248 |
[ |
| 249 |
'label' => esc_html__('Overlay Color', 'ultimate-store-kit'), |
| 250 |
'type' => Controls_Manager::COLOR, |
| 251 |
'selectors' => [ |
| 252 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item-overlay' => 'background: {{VALUE}}', |
| 253 |
], |
| 254 |
'condition' => [ |
| 255 |
'skin_layout!' => ['style-3'] |
| 256 |
] |
| 257 |
] |
| 258 |
); |
| 259 |
$this->add_control( |
| 260 |
'item_overlay_blur_effect', |
| 261 |
[ |
| 262 |
'label' => esc_html__('Glassmorphism', 'ultimate-store-kit'), |
| 263 |
'type' => Controls_Manager::SWITCHER, |
| 264 |
'description' => sprintf(__('This feature will not work in the Firefox browser untill you enable browser compatibility so please %1s look here %2s', 'ultimate-store-kit'), '<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility" target="_blank">', '</a>'), |
| 265 |
'default' => 'yes', |
| 266 |
'condition' => [ |
| 267 |
'skin_layout' => [ |
| 268 |
'style-5', |
| 269 |
] |
| 270 |
] |
| 271 |
] |
| 272 |
); |
| 273 |
|
| 274 |
$this->add_control( |
| 275 |
'item_overlay_blur_level', |
| 276 |
[ |
| 277 |
'label' => __('Blur Level', 'ultimate-store-kit'), |
| 278 |
'type' => Controls_Manager::SLIDER, |
| 279 |
'range' => [ |
| 280 |
'px' => [ |
| 281 |
'min' => 0, |
| 282 |
'step' => 1, |
| 283 |
'max' => 50, |
| 284 |
] |
| 285 |
], |
| 286 |
'default' => [ |
| 287 |
'size' => 10 |
| 288 |
], |
| 289 |
'selectors' => [ |
| 290 |
'{{WRAPPER}} .usk-edd-category-grid.style-5 .usk-edd-category-grid-image:before' => 'backdrop-filter: blur({{SIZE}}px); -webkit-backdrop-filter: blur({{SIZE}}px);' |
| 291 |
], |
| 292 |
'condition' => [ |
| 293 |
'item_overlay_blur_effect' => 'yes', |
| 294 |
'skin_layout' => [ |
| 295 |
'style-5' |
| 296 |
] |
| 297 |
] |
| 298 |
] |
| 299 |
); |
| 300 |
|
| 301 |
$this->add_group_control( |
| 302 |
Group_Control_Background::get_type(), |
| 303 |
[ |
| 304 |
'name' => 'item_background', |
| 305 |
'selector' => '{{WRAPPER}} .usk-edd-category-grid.style-5 .usk-edd-category-grid-image:before', |
| 306 |
'condition' => [ |
| 307 |
'skin_layout' => [ |
| 308 |
'style-5' |
| 309 |
] |
| 310 |
] |
| 311 |
] |
| 312 |
); |
| 313 |
$this->add_responsive_control( |
| 314 |
'item_padding', |
| 315 |
[ |
| 316 |
'label' => esc_html__('Padding', 'ultimate-store-kit'), |
| 317 |
'type' => Controls_Manager::DIMENSIONS, |
| 318 |
'size_units' => ['px', '%', 'em'], |
| 319 |
'selectors' => [ |
| 320 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 321 |
], |
| 322 |
] |
| 323 |
); |
| 324 |
$this->add_responsive_control( |
| 325 |
'item_margin', |
| 326 |
[ |
| 327 |
'label' => esc_html__('Margin', 'ultimate-store-kit'), |
| 328 |
'type' => Controls_Manager::DIMENSIONS, |
| 329 |
'size_units' => ['px', '%', 'em'], |
| 330 |
'selectors' => [ |
| 331 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 332 |
], |
| 333 |
] |
| 334 |
); |
| 335 |
$this->add_group_control( |
| 336 |
Group_Control_Border::get_type(), |
| 337 |
[ |
| 338 |
'name' => 'item_border', |
| 339 |
'label' => esc_html__('Border', 'ultimate-store-kit'), |
| 340 |
'selector' => '{{WRAPPER}} .usk-edd-category-carousel .edd-item', |
| 341 |
] |
| 342 |
); |
| 343 |
$this->add_responsive_control( |
| 344 |
'item_radius', |
| 345 |
[ |
| 346 |
'label' => esc_html__('Radius', 'ultimate-store-kit'), |
| 347 |
'type' => Controls_Manager::DIMENSIONS, |
| 348 |
'size_units' => ['px', '%', 'em'], |
| 349 |
'selectors' => [ |
| 350 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 351 |
], |
| 352 |
] |
| 353 |
); |
| 354 |
|
| 355 |
// $this->add_group_control( |
| 356 |
// Group_Control_Box_Shadow::get_type(), |
| 357 |
// [ |
| 358 |
// 'name' => 'item_shadow', |
| 359 |
// 'selector' => '{{WRAPPER}} .usk-edd-category-carousel .edd-item', |
| 360 |
// ] |
| 361 |
// ); |
| 362 |
$this->end_controls_tab(); |
| 363 |
$this->start_controls_tab( |
| 364 |
'item_tab_hover', |
| 365 |
[ |
| 366 |
'label' => esc_html__('Hover', 'ultimate-store-kit'), |
| 367 |
] |
| 368 |
); |
| 369 |
$this->add_group_control( |
| 370 |
Group_Control_Background::get_type(), |
| 371 |
[ |
| 372 |
'name' => 'items_hover_background', |
| 373 |
'label' => esc_html__('Backgrund', 'ultimate-store-kit'), |
| 374 |
'types' => ['classic', 'gradient'], |
| 375 |
'selector' => '{{WRAPPER}} .usk-edd-category-carousel .edd-item:hover .usk-edd-category-grid-image', |
| 376 |
'condition' => [ |
| 377 |
'skin_layout!' => 'style-5' |
| 378 |
] |
| 379 |
] |
| 380 |
); |
| 381 |
$this->add_control( |
| 382 |
'item_overlay_hover', |
| 383 |
[ |
| 384 |
'label' => esc_html__('Overlay Color', 'ultimate-store-kit'), |
| 385 |
'type' => Controls_Manager::COLOR, |
| 386 |
'selectors' => [ |
| 387 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item:hover .edd-item-overlay' => 'background: {{VALUE}}', |
| 388 |
], |
| 389 |
'condition' => [ |
| 390 |
'skin_layout!' => ['style-3'] |
| 391 |
] |
| 392 |
] |
| 393 |
); |
| 394 |
$this->add_control( |
| 395 |
'item_hover_border_color', |
| 396 |
[ |
| 397 |
'label' => esc_html__('Border Color', 'ultimate-store-kit'), |
| 398 |
'type' => Controls_Manager::COLOR, |
| 399 |
'selectors' => [ |
| 400 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item:hover' => 'border-color: {{VALUE}}', |
| 401 |
], |
| 402 |
] |
| 403 |
); |
| 404 |
$this->end_controls_tab(); |
| 405 |
$this->end_controls_tabs(); |
| 406 |
$this->end_controls_section(); |
| 407 |
$this->start_controls_section( |
| 408 |
'section_style_content', |
| 409 |
[ |
| 410 |
'label' => esc_html__('Content', 'ultimate-store-kit'), |
| 411 |
'tab' => Controls_Manager::TAB_STYLE, |
| 412 |
'condition' => [ |
| 413 |
'skin_layout' => [ |
| 414 |
'style-1' |
| 415 |
] |
| 416 |
] |
| 417 |
] |
| 418 |
); |
| 419 |
$this->start_controls_tabs( |
| 420 |
'content_tabs' |
| 421 |
); |
| 422 |
$this->start_controls_tab( |
| 423 |
'content_tab_normal', |
| 424 |
[ |
| 425 |
'label' => esc_html__('Normal', 'ultimate-store-kit'), |
| 426 |
] |
| 427 |
); |
| 428 |
|
| 429 |
$this->add_group_control( |
| 430 |
Group_Control_Background::get_type(), |
| 431 |
[ |
| 432 |
'name' => 'content_background', |
| 433 |
'selector' => '{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content', |
| 434 |
'condition' => [ |
| 435 |
'skin_layout' => 'style-1' |
| 436 |
] |
| 437 |
] |
| 438 |
); |
| 439 |
|
| 440 |
$this->add_responsive_control( |
| 441 |
'content_padding', |
| 442 |
[ |
| 443 |
'label' => esc_html__('Padding', 'ultimate-store-kit'), |
| 444 |
'type' => Controls_Manager::DIMENSIONS, |
| 445 |
'size_units' => ['px', '%', 'em'], |
| 446 |
'selectors' => [ |
| 447 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 448 |
], |
| 449 |
] |
| 450 |
); |
| 451 |
$this->add_responsive_control( |
| 452 |
'content_margin', |
| 453 |
[ |
| 454 |
'label' => esc_html__('Margin', 'ultimate-store-kit'), |
| 455 |
'type' => Controls_Manager::DIMENSIONS, |
| 456 |
'size_units' => ['px', '%', 'em'], |
| 457 |
'selectors' => [ |
| 458 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 459 |
], |
| 460 |
] |
| 461 |
); |
| 462 |
$this->add_group_control( |
| 463 |
Group_Control_Border::get_type(), |
| 464 |
[ |
| 465 |
'name' => 'content_border', |
| 466 |
'label' => esc_html__('Border', 'ultimate-store-kit'), |
| 467 |
'selector' => '{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content', |
| 468 |
] |
| 469 |
); |
| 470 |
$this->add_responsive_control( |
| 471 |
'content_radius', |
| 472 |
[ |
| 473 |
'label' => esc_html__('Radius', 'ultimate-store-kit'), |
| 474 |
'type' => Controls_Manager::DIMENSIONS, |
| 475 |
'size_units' => ['px', '%', 'em'], |
| 476 |
'selectors' => [ |
| 477 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 478 |
], |
| 479 |
] |
| 480 |
); |
| 481 |
|
| 482 |
$this->add_group_control( |
| 483 |
Group_Control_Box_Shadow::get_type(), |
| 484 |
[ |
| 485 |
'name' => 'content_shadow', |
| 486 |
'selector' => '{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content', |
| 487 |
] |
| 488 |
); |
| 489 |
$this->end_controls_tab(); |
| 490 |
$this->start_controls_tab( |
| 491 |
'content_tab_hover', |
| 492 |
[ |
| 493 |
'label' => esc_html__('Hover', 'ultimate-store-kit'), |
| 494 |
] |
| 495 |
); |
| 496 |
$this->add_control( |
| 497 |
'content_hover_border_color', |
| 498 |
[ |
| 499 |
'label' => esc_html__('Border Color', 'ultimate-store-kit'), |
| 500 |
'type' => Controls_Manager::COLOR, |
| 501 |
'selectors' => [ |
| 502 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item:hover .edd-content' => 'border-color: {{VALUE}}', |
| 503 |
], |
| 504 |
] |
| 505 |
); |
| 506 |
$this->add_group_control( |
| 507 |
Group_Control_Box_Shadow::get_type(), |
| 508 |
[ |
| 509 |
'name' => 'content_hover_shadow', |
| 510 |
'selector' => '{{WRAPPER}} .usk-edd-category-carousel .edd-item:hover .edd-content', |
| 511 |
] |
| 512 |
); |
| 513 |
$this->end_controls_tab(); |
| 514 |
$this->end_controls_tabs(); |
| 515 |
$this->end_controls_section(); |
| 516 |
$this->start_controls_section( |
| 517 |
'section_style_category', |
| 518 |
[ |
| 519 |
'label' => esc_html__('Category', 'ultimate-store-kit'), |
| 520 |
'tab' => Controls_Manager::TAB_STYLE, |
| 521 |
] |
| 522 |
); |
| 523 |
$this->start_controls_tabs( |
| 524 |
'category_tabs' |
| 525 |
); |
| 526 |
$this->start_controls_tab( |
| 527 |
'category_tab_normal', |
| 528 |
[ |
| 529 |
'label' => esc_html__('Normal', 'ultimate-store-kit'), |
| 530 |
] |
| 531 |
); |
| 532 |
$this->add_control( |
| 533 |
'category_color', |
| 534 |
[ |
| 535 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 536 |
'type' => Controls_Manager::COLOR, |
| 537 |
'selectors' => [ |
| 538 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content .title' => 'color: {{VALUE}}', |
| 539 |
], |
| 540 |
] |
| 541 |
); |
| 542 |
$this->add_group_control( |
| 543 |
Group_Control_Background::get_type(), |
| 544 |
[ |
| 545 |
'name' => 'style_5_category_bg', |
| 546 |
'label' => esc_html__('Backgorund', 'ultimate-store-kit'), |
| 547 |
'types' => ['classic', 'gradient'], |
| 548 |
'selector' => '{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content .title', |
| 549 |
'condition' => [ |
| 550 |
'skin_layout' => [ |
| 551 |
'style-5' |
| 552 |
] |
| 553 |
] |
| 554 |
] |
| 555 |
); |
| 556 |
$this->add_group_control( |
| 557 |
Group_Control_Background::get_type(), |
| 558 |
[ |
| 559 |
'name' => 'style_6_category_bg', |
| 560 |
'label' => esc_html__('Background', 'ultimate-store-kit'), |
| 561 |
'types' => ['classic', 'gradient'], |
| 562 |
'selector' => '{{WRAPPER}} .usk-edd-category-carousel.style-5 .usk-edd-category-carousel-image:before', |
| 563 |
'condition' => [ |
| 564 |
'skin_layout' => [ |
| 565 |
'style-6' |
| 566 |
] |
| 567 |
] |
| 568 |
] |
| 569 |
); |
| 570 |
$this->add_responsive_control( |
| 571 |
'category_margin', |
| 572 |
[ |
| 573 |
'label' => esc_html__('Margin', 'ultimate-store-kit'), |
| 574 |
'type' => Controls_Manager::DIMENSIONS, |
| 575 |
'size_units' => ['px', '%'], |
| 576 |
'selectors' => [ |
| 577 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content .title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 578 |
], |
| 579 |
] |
| 580 |
); |
| 581 |
$this->add_responsive_control( |
| 582 |
'category_padding', |
| 583 |
[ |
| 584 |
'label' => esc_html__('Padding', 'ultimate-store-kit'), |
| 585 |
'type' => Controls_Manager::DIMENSIONS, |
| 586 |
'size_units' => ['px', '%'], |
| 587 |
'selectors' => [ |
| 588 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content .title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 589 |
], |
| 590 |
'condition' => [ |
| 591 |
'skin_layout' => [ |
| 592 |
'style-4' |
| 593 |
] |
| 594 |
] |
| 595 |
] |
| 596 |
); |
| 597 |
|
| 598 |
$this->add_group_control( |
| 599 |
Group_Control_Typography::get_type(), |
| 600 |
[ |
| 601 |
'name' => 'category_typography', |
| 602 |
'label' => esc_html__('Typography', 'ultimate-store-kit'), |
| 603 |
'exclude' => ['line_height'], |
| 604 |
'selector' => '{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content .title', |
| 605 |
] |
| 606 |
); |
| 607 |
$this->end_controls_tab(); |
| 608 |
$this->start_controls_tab( |
| 609 |
'category_tab_hover', |
| 610 |
[ |
| 611 |
'label' => esc_html__('Hover', 'ultimate-store-kit'), |
| 612 |
'condition' => [ |
| 613 |
'skin_layout!' => 'style-5' |
| 614 |
] |
| 615 |
] |
| 616 |
); |
| 617 |
$this->add_control( |
| 618 |
'hover_category_color', |
| 619 |
[ |
| 620 |
'label' => esc_html__('Hover Color', 'ultimate-store-kit'), |
| 621 |
'type' => Controls_Manager::COLOR, |
| 622 |
'selectors' => [ |
| 623 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item:hover .edd-content .title' => 'color: {{VALUE}};', |
| 624 |
], |
| 625 |
] |
| 626 |
); |
| 627 |
$this->end_controls_tab(); |
| 628 |
$this->end_controls_tabs(); |
| 629 |
$this->end_controls_section(); |
| 630 |
$this->start_controls_section( |
| 631 |
'section_style_count', |
| 632 |
[ |
| 633 |
'label' => esc_html__('Count', 'ultimate-store-kit'), |
| 634 |
'tab' => Controls_Manager::TAB_STYLE, |
| 635 |
] |
| 636 |
); |
| 637 |
$this->start_controls_tabs( |
| 638 |
'count_tabs' |
| 639 |
); |
| 640 |
$this->start_controls_tab( |
| 641 |
'count_tab_normal', |
| 642 |
[ |
| 643 |
'label' => esc_html__('Normal', 'ultimate-store-kit'), |
| 644 |
'condition' => [ |
| 645 |
'skin_layout!' => [ |
| 646 |
'style-5' |
| 647 |
] |
| 648 |
] |
| 649 |
] |
| 650 |
); |
| 651 |
$this->add_control( |
| 652 |
'count_color', |
| 653 |
[ |
| 654 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 655 |
'type' => Controls_Manager::COLOR, |
| 656 |
'selectors' => [ |
| 657 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content .edd-category-count > *' => 'color: {{VALUE}};', |
| 658 |
], |
| 659 |
] |
| 660 |
); |
| 661 |
$this->add_group_control( |
| 662 |
Group_Control_Background::get_type(), |
| 663 |
[ |
| 664 |
'name' => 'count_background', |
| 665 |
'label' => esc_html__('Background', 'ultimate-store-kit'), |
| 666 |
'types' => ['classic', 'gradient'], |
| 667 |
'selector' => '{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content .edd-category-count > *', |
| 668 |
'condition' => [ |
| 669 |
'skin_layout' => [ |
| 670 |
'style-2' |
| 671 |
] |
| 672 |
] |
| 673 |
] |
| 674 |
); |
| 675 |
$this->add_responsive_control( |
| 676 |
'count_number_size', |
| 677 |
[ |
| 678 |
'label' => esc_html__('Size', 'ultimate-store-kit'), |
| 679 |
'type' => Controls_Manager::SLIDER, |
| 680 |
'size_units' => ['px'], |
| 681 |
'default' => [ |
| 682 |
'unit' => 'px', |
| 683 |
'size' => 30, |
| 684 |
], |
| 685 |
'selectors' => [ |
| 686 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content .edd-category-count > *' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}};', |
| 687 |
], |
| 688 |
'condition' => [ |
| 689 |
'skin_layout' => [ |
| 690 |
'style-2' |
| 691 |
] |
| 692 |
] |
| 693 |
] |
| 694 |
); |
| 695 |
// $this->add_responsive_control( |
| 696 |
// 'count_padding', |
| 697 |
// [ |
| 698 |
// 'label' => __('Padding', 'ultimate-store-kit'), |
| 699 |
// 'type' => Controls_Manager::DIMENSIONS, |
| 700 |
// 'size_units' => ['px', 'em', '%'], |
| 701 |
// 'selectors' => [ |
| 702 |
// '{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content .edd-category-count > *' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 703 |
// ], |
| 704 |
// ] |
| 705 |
// ); |
| 706 |
$this->add_group_control( |
| 707 |
Group_Control_Typography::get_type(), |
| 708 |
[ |
| 709 |
'name' => 'count_typography', |
| 710 |
'label' => esc_html__('Typography', 'ultimate-store-kit'), |
| 711 |
'selector' => '{{WRAPPER}} .usk-edd-category-carousel .edd-item .edd-content .edd-category-count > *', |
| 712 |
] |
| 713 |
); |
| 714 |
$this->end_controls_tab(); |
| 715 |
$this->start_controls_tab( |
| 716 |
'count_tab_hover', |
| 717 |
[ |
| 718 |
'label' => esc_html__('Hover', 'ultimate-store-kit'), |
| 719 |
] |
| 720 |
); |
| 721 |
$this->add_control( |
| 722 |
'count_color_hover', |
| 723 |
[ |
| 724 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 725 |
'type' => Controls_Manager::COLOR, |
| 726 |
'selectors' => [ |
| 727 |
'{{WRAPPER}} .usk-edd-category-carousel .edd-item:hover .edd-content .edd-category-count > *' => 'color: {{VALUE}};', |
| 728 |
], |
| 729 |
] |
| 730 |
); |
| 731 |
$this->add_group_control( |
| 732 |
Group_Control_Background::get_type(), |
| 733 |
[ |
| 734 |
'name' => 'count_hover_background', |
| 735 |
'label' => esc_html__('Background', 'ultimate-store-kit'), |
| 736 |
'types' => ['classic', 'gradient'], |
| 737 |
'selector' => '{{WRAPPER}} .usk-edd-category-carousel .edd-item:hover .edd-content .edd-category-count > *', |
| 738 |
'condition' => [ |
| 739 |
'skin_layout' => [ |
| 740 |
'style-2' |
| 741 |
] |
| 742 |
] |
| 743 |
] |
| 744 |
); |
| 745 |
$this->end_controls_tab(); |
| 746 |
$this->end_controls_tabs(); |
| 747 |
$this->end_controls_section(); |
| 748 |
$this->register_global_controls_navigation_style(); |
| 749 |
} |
| 750 |
public function render_query() { |
| 751 |
$settings = $this->get_settings_for_display(); |
| 752 |
$args = [ |
| 753 |
'orderby' => isset($settings['orderby']) ? $settings['orderby'] : 'name', |
| 754 |
'order' => isset($settings['order']) ? $settings['order'] : 'ASC', |
| 755 |
'hide_empty' => isset($settings['hide_empty']) && ($settings['hide_empty'] == 'yes') ? 0 : 1, |
| 756 |
]; |
| 757 |
|
| 758 |
|
| 759 |
switch ($settings['display_category']) { |
| 760 |
case 'all': |
| 761 |
if (isset($settings['cats_include_by_id']) && !empty($settings['cats_include_by_id'])) { |
| 762 |
$args['include'] = $settings['cats_include_by_id']; |
| 763 |
} |
| 764 |
if (isset($settings['cats_exclude_by_id']) && !empty($settings['cats_exclude_by_id'])) { |
| 765 |
$args['exclude'] = $settings['cats_exclude_by_id']; |
| 766 |
} |
| 767 |
break; |
| 768 |
case 'child': |
| 769 |
if ($settings['parent_cats'] != 'none' && !empty($settings['parent_cats'])) { |
| 770 |
$args['child_of'] = $settings['parent_cats']; |
| 771 |
} |
| 772 |
break; |
| 773 |
case 'parents': |
| 774 |
$args['parent'] = 0; |
| 775 |
break; |
| 776 |
} |
| 777 |
$categories = get_terms('download_category', $args); |
| 778 |
return $categories; |
| 779 |
} |
| 780 |
public function render_image() { |
| 781 |
$settings = $this->get_settings_for_display(); |
| 782 |
$image_src = Utils::get_placeholder_image_src(); |
| 783 |
?> |
| 784 |
<div class="usk-edd-category-carousel-image"> |
| 785 |
<?php if ($settings['is_use_image']) : |
| 786 |
$thumb_url = Group_Control_Image_Size::get_attachment_image_src($settings['category_image']['id'], 'category_thumbnail', $settings); |
| 787 |
if (!empty($thumb_url)) { |
| 788 |
$image_src = $settings['category_image']['url']; |
| 789 |
} |
| 790 |
?> |
| 791 |
<img src="<?php echo esc_url($image_src); ?>" alt=""> |
| 792 |
<?php endif; ?> |
| 793 |
</div><?php |
| 794 |
} |
| 795 |
public function render_loop_item() { |
| 796 |
$settings = $this->get_settings_for_display(); |
| 797 |
$categories = $this->render_query(); |
| 798 |
?> |
| 799 |
<?php |
| 800 |
if (!empty($categories)) { |
| 801 |
foreach ($categories as $index => $category) : |
| 802 |
// print_r($category->cat_ID); |
| 803 |
// die; |
| 804 |
$this->add_render_attribute('edd-category-item', 'class', ['edd-item swiper-slide', 'category-link'], true); |
| 805 |
$this->add_render_attribute('edd-category-item', 'href', get_term_link($category->term_id, 'download_category'), true); ?> |
| 806 |
<a <?php $this->print_render_attribute_string('edd-category-item'); ?>> |
| 807 |
<?php $this->render_image(); ?> |
| 808 |
<div class="edd-content"> |
| 809 |
<?php printf('<h3 class="title">%s</h3>', esc_html($category->name)); ?> |
| 810 |
<?php if ($settings['show_count']) : |
| 811 |
printf('<p class="edd-category-count"><span class="edd-count-number">%s</span><span class="edd-count-text">products</span></p>', esc_html($category->count)); |
| 812 |
endif; |
| 813 |
?> |
| 814 |
</div> |
| 815 |
<div class="edd-item-overlay"></div> |
| 816 |
</a> |
| 817 |
<?php |
| 818 |
// if (!empty($settings['item_limit']['size'])) { |
| 819 |
// if ($index == ($settings['item_limit']['size'] - 1)) break; |
| 820 |
// } |
| 821 |
endforeach; |
| 822 |
} else { |
| 823 |
printf('<span class="bdt-warning">%s</span>', esc_html__('Opps, Nothing found to display', 'ultimate-store-kit')); |
| 824 |
} |
| 825 |
} |
| 826 |
|
| 827 |
public function render() { |
| 828 |
$settings = $this->get_settings_for_display(); |
| 829 |
$this->add_render_attribute('usk-carousel-wrapper', 'class', [$settings['skin_layout']]); |
| 830 |
$this->register_global_template_carousel_header(); |
| 831 |
$this->render_loop_item(); |
| 832 |
$this->usk_register_global_template_carousel_footer(); |
| 833 |
} |
| 834 |
} |
| 835 |
|