| 1 |
<?php |
| 2 |
/** @noinspection SpellCheckingInspection, DuplicatedCode, PhpUnused */ |
| 3 |
|
| 4 |
namespace King_Addons; |
| 5 |
|
| 6 |
use Elementor\Controls_Manager; |
| 7 |
use Elementor\Group_Control_Background; |
| 8 |
use Elementor\Group_Control_Border; |
| 9 |
use Elementor\Group_Control_Box_Shadow; |
| 10 |
use Elementor\Group_Control_Css_Filter; |
| 11 |
use Elementor\Group_Control_Image_Size; |
| 12 |
use Elementor\Group_Control_Typography; |
| 13 |
use Elementor\Icons_Manager; |
| 14 |
use Elementor\Repeater; |
| 15 |
use Elementor\Utils; |
| 16 |
use Elementor\Widget_Base; |
| 17 |
|
| 18 |
if (!defined('ABSPATH')) { |
| 19 |
exit; // Exit if accessed directly. |
| 20 |
} |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
class Testimonial_Carousel extends Widget_Base |
| 25 |
{ |
| 26 |
|
| 27 |
|
| 28 |
public function get_name(): string |
| 29 |
{ |
| 30 |
return 'king-addons-testimonial-carousel'; |
| 31 |
} |
| 32 |
|
| 33 |
public function get_title(): string |
| 34 |
{ |
| 35 |
return esc_html__('Testimonial & Review Carousel', 'king-addons'); |
| 36 |
} |
| 37 |
|
| 38 |
public function get_icon(): string |
| 39 |
{ |
| 40 |
return 'king-addons-icon king-addons-testimonial-carousel'; |
| 41 |
} |
| 42 |
|
| 43 |
public function get_script_depends(): array |
| 44 |
{ |
| 45 |
return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-swiper-swiper']; |
| 46 |
} |
| 47 |
|
| 48 |
public function get_style_depends(): array |
| 49 |
{ |
| 50 |
return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-swiper-swiper', KING_ADDONS_ASSETS_UNIQUE_KEY . '-testimonial-carousel-style']; |
| 51 |
} |
| 52 |
|
| 53 |
public function get_categories(): array |
| 54 |
{ |
| 55 |
return ['king-addons']; |
| 56 |
} |
| 57 |
|
| 58 |
public function get_keywords(): array |
| 59 |
{ |
| 60 |
return ['testimonial', 'slider', 'carousel', 'testimonial carousel', 'testimonials', |
| 61 |
'review', 'reviews', 'rating', 'ratings', 'stars', 'rate', 'star', |
| 62 |
'king addons', 'king', 'addons', 'kingaddons', 'king-addons']; |
| 63 |
} |
| 64 |
|
| 65 |
public function get_custom_help_url() |
| 66 |
{ |
| 67 |
return 'mailto:bug@kingaddons.com?subject=Bug Report - King Addons&body=Please describe the issue'; |
| 68 |
} |
| 69 |
|
| 70 |
protected function register_controls(): void |
| 71 |
{ |
| 72 |
$this->start_controls_section( |
| 73 |
'king_addons_testimonial_carousel_layout_section', |
| 74 |
[ |
| 75 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Layout', 'king-addons'), |
| 76 |
'tab' => Controls_Manager::TAB_CONTENT |
| 77 |
] |
| 78 |
); |
| 79 |
|
| 80 |
// selector - testimonial layouts |
| 81 |
$this->add_control( |
| 82 |
'king_addons_testimonial_carousel_layout', |
| 83 |
array( |
| 84 |
'label' => '<b>' . esc_html__('Layout', 'king-addons') . '</b>', |
| 85 |
'type' => Controls_Manager::SELECT, |
| 86 |
'options' => array( |
| 87 |
'layout-1' => esc_html__('Default - Image, Desc, Rating, Bio', 'king-addons'), |
| 88 |
'layout-8' => esc_html__('Default Centered - Image, Desc, Rating, Bio', 'king-addons'), |
| 89 |
'layout-2' => esc_html__('Classic - Desc, Bio, Rating, Image', 'king-addons'), |
| 90 |
'layout-3' => esc_html__('Desc, Image, Bio, Rating', 'king-addons'), |
| 91 |
'layout-4' => esc_html__('Image | Content', 'king-addons'), |
| 92 |
'layout-5' => esc_html__('Content | Image', 'king-addons'), |
| 93 |
'layout-6' => esc_html__('Desc | Bottom Bio', 'king-addons'), |
| 94 |
'layout-7' => esc_html__('Top Bio | Desc', 'king-addons'), |
| 95 |
), |
| 96 |
'render_type' => 'template', |
| 97 |
'default' => 'layout-8', |
| 98 |
) |
| 99 |
); |
| 100 |
|
| 101 |
$this->end_controls_section(); |
| 102 |
|
| 103 |
$this->start_controls_section( |
| 104 |
'king_addons_testimonial_carousel_content_section', |
| 105 |
[ |
| 106 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Content', 'king-addons'), |
| 107 |
'tab' => Controls_Manager::TAB_CONTENT |
| 108 |
] |
| 109 |
); |
| 110 |
|
| 111 |
$repeater = new Repeater(); |
| 112 |
|
| 113 |
$repeater->add_control( |
| 114 |
'king_addons_testimonial_carousel_image', |
| 115 |
[ |
| 116 |
'label' => esc_html__('Image', 'king-addons'), |
| 117 |
'type' => Controls_Manager::MEDIA, |
| 118 |
'dynamic' => array('active' => true), |
| 119 |
'default' => array( |
| 120 |
'url' => Utils::get_placeholder_image_src(), |
| 121 |
), |
| 122 |
'show_external' => true, |
| 123 |
] |
| 124 |
); |
| 125 |
|
| 126 |
$repeater->add_control( |
| 127 |
'king_addons_testimonial_carousel_title', |
| 128 |
[ |
| 129 |
'label' => '<b>' . esc_html__('Title', 'king-addons') . '</b>', |
| 130 |
'type' => Controls_Manager::TEXT, |
| 131 |
'label_block' => true, |
| 132 |
'default' => esc_html__('Title', 'king-addons'), |
| 133 |
] |
| 134 |
); |
| 135 |
|
| 136 |
$repeater->add_control( |
| 137 |
'king_addons_testimonial_carousel_subtitle', |
| 138 |
[ |
| 139 |
'label' => '<b>' . esc_html__('Subtitle', 'king-addons') . '</b>', |
| 140 |
'type' => Controls_Manager::TEXT, |
| 141 |
'label_block' => true, |
| 142 |
'default' => esc_html__('Subtitle', 'king-addons'), |
| 143 |
'separator' => 'before' |
| 144 |
] |
| 145 |
); |
| 146 |
|
| 147 |
$repeater->add_control( |
| 148 |
'king_addons_testimonial_carousel_rating_value', |
| 149 |
[ |
| 150 |
'label' => '<b>' . esc_html__('Rating', 'king-addons') . '</b>', |
| 151 |
'type' => Controls_Manager::NUMBER, |
| 152 |
'min' => 0, |
| 153 |
'max' => 10, |
| 154 |
'default' => 5, |
| 155 |
'step' => 0.25, |
| 156 |
'dynamic' => [ |
| 157 |
'active' => true, |
| 158 |
], |
| 159 |
] |
| 160 |
); |
| 161 |
|
| 162 |
$repeater->add_control( |
| 163 |
'king_addons_testimonial_carousel_description_title', |
| 164 |
[ |
| 165 |
'label' => '<b>' . esc_html__('Description', 'king-addons') . '</b>', |
| 166 |
'type' => Controls_Manager::RAW_HTML, |
| 167 |
'separator' => 'before', |
| 168 |
] |
| 169 |
); |
| 170 |
|
| 171 |
$repeater->add_control( |
| 172 |
'king_addons_testimonial_carousel_description', |
| 173 |
[ |
| 174 |
'label' => '<b>' . esc_html__('Description', 'king-addons') . '</b>', |
| 175 |
'type' => Controls_Manager::WYSIWYG, |
| 176 |
'show_label' => false, |
| 177 |
'default' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'king-addons'), |
| 178 |
'placeholder' => esc_html__('Type the description here', 'king-addons'), |
| 179 |
] |
| 180 |
); |
| 181 |
|
| 182 |
$default_cards = [ |
| 183 |
'king_addons_testimonial_carousel_image' => Utils::get_placeholder_image_src(), |
| 184 |
'king_addons_testimonial_carousel_title' => esc_html__('Title', 'king-addons'), |
| 185 |
'king_addons_testimonial_carousel_subtitle' => esc_html__('Subtitle', 'king-addons'), |
| 186 |
'king_addons_testimonial_carousel_rating_value' => 5, |
| 187 |
'king_addons_testimonial_carousel_description' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'king-addons'), |
| 188 |
]; |
| 189 |
|
| 190 |
$this->add_control( |
| 191 |
'king_addons_testimonial_carousel_content_items', |
| 192 |
[ |
| 193 |
'type' => Controls_Manager::REPEATER, |
| 194 |
'fields' => $repeater->get_controls(), |
| 195 |
'default' => array_fill(0, 5, $default_cards), |
| 196 |
'title_field' => '{{king_addons_testimonial_carousel_title}}', |
| 197 |
] |
| 198 |
); |
| 199 |
|
| 200 |
$this->end_controls_section(); |
| 201 |
|
| 202 |
$this->start_controls_section( |
| 203 |
'king_addons_testimonial_carousel_image_section', |
| 204 |
[ |
| 205 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Image', 'king-addons'), |
| 206 |
'tab' => Controls_Manager::TAB_CONTENT |
| 207 |
] |
| 208 |
); |
| 209 |
|
| 210 |
$this->add_control( |
| 211 |
'king_addons_testimonial_carousel_image_switcher', |
| 212 |
array( |
| 213 |
'label' => esc_html__('Show Image', 'king-addons'), |
| 214 |
'type' => Controls_Manager::SWITCHER, |
| 215 |
'default' => 'yes', |
| 216 |
'return_value' => 'yes', |
| 217 |
) |
| 218 |
); |
| 219 |
|
| 220 |
$this->add_group_control( |
| 221 |
Group_Control_Image_Size::get_type(), |
| 222 |
[ |
| 223 |
'name' => 'king_addons_testimonial_carousel_image_size', |
| 224 |
'default' => 'medium', |
| 225 |
'condition' => array( |
| 226 |
'king_addons_testimonial_carousel_image_switcher' => 'yes', |
| 227 |
), |
| 228 |
] |
| 229 |
); |
| 230 |
|
| 231 |
$this->end_controls_section(); |
| 232 |
|
| 233 |
// RATING ================================================= |
| 234 |
$this->start_controls_section( |
| 235 |
'king_addons_testimonial_carousel_section_rating', |
| 236 |
[ |
| 237 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Rating', 'king-addons'), |
| 238 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 239 |
] |
| 240 |
); |
| 241 |
|
| 242 |
$this->add_control( |
| 243 |
'king_addons_testimonial_carousel_rating_switcher', |
| 244 |
array( |
| 245 |
'label' => esc_html__('Show Rating', 'king-addons'), |
| 246 |
'type' => Controls_Manager::SWITCHER, |
| 247 |
'default' => 'yes', |
| 248 |
'return_value' => 'yes', |
| 249 |
) |
| 250 |
); |
| 251 |
|
| 252 |
$this->add_control( |
| 253 |
'king_addons_testimonial_carousel_rating_scale', |
| 254 |
[ |
| 255 |
'label' => esc_html__('Rating Scale', 'king-addons'), |
| 256 |
'type' => Controls_Manager::SLIDER, |
| 257 |
'range' => [ |
| 258 |
'px' => [ |
| 259 |
'min' => 1, |
| 260 |
'max' => 10, |
| 261 |
], |
| 262 |
], |
| 263 |
'default' => [ |
| 264 |
'size' => 5, |
| 265 |
], |
| 266 |
'condition' => array( |
| 267 |
'king_addons_testimonial_carousel_rating_switcher' => 'yes', |
| 268 |
), |
| 269 |
'separator' => 'before', |
| 270 |
] |
| 271 |
); |
| 272 |
|
| 273 |
$this->add_control( |
| 274 |
'king_addons_testimonial_carousel_rating_icon', |
| 275 |
[ |
| 276 |
'label' => esc_html__('Icon', 'king-addons'), |
| 277 |
'type' => Controls_Manager::ICONS, |
| 278 |
'fa4compatibility' => 'icon', |
| 279 |
'skin' => 'inline', |
| 280 |
'label_block' => false, |
| 281 |
'skin_settings' => [ |
| 282 |
'inline' => [ |
| 283 |
'icon' => [ |
| 284 |
'icon' => 'eicon-star', |
| 285 |
], |
| 286 |
], |
| 287 |
], |
| 288 |
'default' => [ |
| 289 |
'value' => 'eicon-star', |
| 290 |
'library' => 'eicons', |
| 291 |
], |
| 292 |
'separator' => 'before', |
| 293 |
'exclude_inline_options' => ['none'], |
| 294 |
'condition' => array( |
| 295 |
'king_addons_testimonial_carousel_rating_switcher' => 'yes', |
| 296 |
), |
| 297 |
] |
| 298 |
); |
| 299 |
|
| 300 |
$this->end_controls_section(); |
| 301 |
// END: RATING ============================================ |
| 302 |
|
| 303 |
/** SECTION: Carousel Settings */ |
| 304 |
$this->start_controls_section( |
| 305 |
'king_addons_testimonial_carousel_sw_content_section_carousel_settings', |
| 306 |
[ |
| 307 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Carousel Settings', 'king-addons'), |
| 308 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 309 |
] |
| 310 |
); |
| 311 |
|
| 312 |
$this->add_control( |
| 313 |
'king_addons_testimonial_carousel_sw_loop_switcher', |
| 314 |
[ |
| 315 |
'label' => esc_html__('Loop Cards', 'king-addons'), |
| 316 |
'type' => Controls_Manager::SWITCHER, |
| 317 |
'default' => 'yes' |
| 318 |
] |
| 319 |
); |
| 320 |
|
| 321 |
$this->add_control( |
| 322 |
'king_addons_testimonial_carousel_sw_rewind_switcher', |
| 323 |
[ |
| 324 |
'label' => esc_html__('Rewind Cards', 'king-addons'), |
| 325 |
'description' => esc_html__('When enabled, clicking the next navigation button when on last slide will slide back to the first slide. Clicking the prev navigation button when on first slide will slide forward to the last slide. Should not be used together with loop mode.', 'king-addons'), |
| 326 |
'type' => Controls_Manager::SWITCHER |
| 327 |
] |
| 328 |
); |
| 329 |
|
| 330 |
$this->add_control( |
| 331 |
'king_addons_testimonial_carousel_sw_autoplay_switcher', |
| 332 |
[ |
| 333 |
'label' => esc_html__('Autoplay Carousel Cards', 'king-addons'), |
| 334 |
'type' => Controls_Manager::SWITCHER, |
| 335 |
'separator' => 'before', |
| 336 |
] |
| 337 |
); |
| 338 |
|
| 339 |
$this->add_control( |
| 340 |
'king_addons_testimonial_carousel_sw_autoplay_delay', |
| 341 |
[ |
| 342 |
'label' => esc_html__('Delay between transitions (ms)', 'king-addons'), |
| 343 |
'type' => Controls_Manager::NUMBER, |
| 344 |
'min' => 0, |
| 345 |
'step' => 10, |
| 346 |
'default' => 3000, |
| 347 |
'condition' => [ |
| 348 |
'king_addons_testimonial_carousel_sw_autoplay_switcher!' => '', |
| 349 |
'king_addons_testimonial_carousel_sw_autoplay_like_ticker_switcher!' => 'yes', |
| 350 |
] |
| 351 |
] |
| 352 |
); |
| 353 |
|
| 354 |
$this->add_control( |
| 355 |
'king_addons_testimonial_carousel_sw_autoplay_disableoninteraction_switcher', |
| 356 |
[ |
| 357 |
'label' => esc_html__('Disable on interaction', 'king-addons'), |
| 358 |
'description' => esc_html__('Autoplay will be disabled after user interactions (swipes), it will not be restarted every time after interaction.', 'king-addons'), |
| 359 |
'type' => Controls_Manager::SWITCHER, |
| 360 |
'condition' => [ |
| 361 |
'king_addons_testimonial_carousel_sw_autoplay_switcher!' => '', |
| 362 |
] |
| 363 |
] |
| 364 |
); |
| 365 |
|
| 366 |
$this->add_control( |
| 367 |
'king_addons_testimonial_carousel_sw_autoplay_pausedonmouseenter_switcher', |
| 368 |
[ |
| 369 |
'label' => esc_html__('Pause on mouse enter', 'king-addons'), |
| 370 |
'description' => esc_html__('When enabled autoplay will be paused on pointer (mouse) enter over carousel container.', 'king-addons'), |
| 371 |
'type' => Controls_Manager::SWITCHER, |
| 372 |
'condition' => [ |
| 373 |
'king_addons_testimonial_carousel_sw_autoplay_switcher!' => '', |
| 374 |
] |
| 375 |
] |
| 376 |
); |
| 377 |
|
| 378 |
$this->add_control( |
| 379 |
'king_addons_testimonial_carousel_sw_autoplay_reversedirection_switcher', |
| 380 |
[ |
| 381 |
'label' => esc_html__('Reverse Direction', 'king-addons'), |
| 382 |
'description' => esc_html__('Enables autoplay in reverse direction.', 'king-addons'), |
| 383 |
'type' => Controls_Manager::SWITCHER, |
| 384 |
'condition' => [ |
| 385 |
'king_addons_testimonial_carousel_sw_autoplay_switcher!' => '', |
| 386 |
] |
| 387 |
] |
| 388 |
); |
| 389 |
|
| 390 |
$this->add_control( |
| 391 |
'king_addons_testimonial_carousel_sw_autoplay_like_ticker_switcher', |
| 392 |
[ |
| 393 |
'label' => esc_html__('Autoplay Like Ticker (marquee effect)', 'king-addons'), |
| 394 |
'description' => esc_html__('Autoscrolls cards as on ticker, also known as marquee effect.', 'king-addons'), |
| 395 |
'type' => Controls_Manager::SWITCHER, |
| 396 |
'condition' => [ |
| 397 |
'king_addons_testimonial_carousel_sw_autoplay_switcher!' => '', |
| 398 |
], |
| 399 |
] |
| 400 |
); |
| 401 |
|
| 402 |
$this->add_control( |
| 403 |
'king_addons_testimonial_carousel_sw_autoplay_like_ticker_autoplay_speed', |
| 404 |
[ |
| 405 |
'label' => esc_html__('Autoplay Speed (ms)', 'king-addons'), |
| 406 |
'type' => Controls_Manager::NUMBER, |
| 407 |
'min' => 0, |
| 408 |
'step' => 10, |
| 409 |
'default' => 6000, |
| 410 |
'condition' => [ |
| 411 |
'king_addons_testimonial_carousel_sw_autoplay_like_ticker_switcher' => 'yes', |
| 412 |
] |
| 413 |
] |
| 414 |
); |
| 415 |
|
| 416 |
$this->add_control( |
| 417 |
'king_addons_testimonial_carousel_sw_scrolling_speed', |
| 418 |
[ |
| 419 |
'label' => esc_html__('Scrolling Speed (ms)', 'king-addons'), |
| 420 |
'type' => Controls_Manager::NUMBER, |
| 421 |
'min' => 0, |
| 422 |
'step' => 10, |
| 423 |
'default' => 600, |
| 424 |
'separator' => 'before', |
| 425 |
'condition' => [ |
| 426 |
'king_addons_testimonial_carousel_sw_autoplay_like_ticker_switcher!' => 'yes', |
| 427 |
] |
| 428 |
] |
| 429 |
); |
| 430 |
|
| 431 |
$this->add_responsive_control( |
| 432 |
'king_addons_testimonial_carousel_sw_align_card_full_height', |
| 433 |
[ |
| 434 |
'label' => esc_html__('Make testimonial full height', 'king-addons'), |
| 435 |
'type' => Controls_Manager::SELECT, |
| 436 |
'default' => 'auto', |
| 437 |
'options' => [ |
| 438 |
'100%' => esc_html__('Yes', 'king-addons'), |
| 439 |
'auto' => esc_html__('No', 'king-addons'), |
| 440 |
], |
| 441 |
'separator' => 'before', |
| 442 |
'selectors' => [ |
| 443 |
'{{WRAPPER}} .swiper-slide' => 'height: auto;', |
| 444 |
'{{WRAPPER}} .swiper-slide .king-addons-testimonial-carousel-layout' => 'height: {{VALUE}};', |
| 445 |
], |
| 446 |
] |
| 447 |
); |
| 448 |
|
| 449 |
$this->add_responsive_control( |
| 450 |
'king_addons_testimonial_carousel_sw_align_card', |
| 451 |
[ |
| 452 |
'label' => esc_html__('Align Whole Card', 'king-addons'), |
| 453 |
'type' => Controls_Manager::SELECT, |
| 454 |
'options' => [ |
| 455 |
'unset' => esc_html__('Default', 'king-addons'), |
| 456 |
'start' => esc_html__('Start', 'king-addons'), |
| 457 |
'center' => esc_html__('Center', 'king-addons'), |
| 458 |
'end' => esc_html__('End', 'king-addons'), |
| 459 |
], |
| 460 |
'default' => 'center', |
| 461 |
'selectors' => [ |
| 462 |
'{{WRAPPER}} .swiper-slide' => 'align-content: {{VALUE}};', |
| 463 |
], |
| 464 |
'condition' => [ |
| 465 |
'king_addons_testimonial_carousel_sw_align_card_full_height' => 'auto' |
| 466 |
], |
| 467 |
] |
| 468 |
); |
| 469 |
|
| 470 |
$this->add_responsive_control( |
| 471 |
'king_addons_testimonial_carousel_sw_align_card_content', |
| 472 |
[ |
| 473 |
'label' => esc_html__('Align Card Content', 'king-addons'), |
| 474 |
'type' => Controls_Manager::SELECT, |
| 475 |
'options' => [ |
| 476 |
'unset' => esc_html__('Default', 'king-addons'), |
| 477 |
'start' => esc_html__('Start', 'king-addons'), |
| 478 |
'center' => esc_html__('Center', 'king-addons'), |
| 479 |
'end' => esc_html__('End', 'king-addons'), |
| 480 |
], |
| 481 |
'default' => 'center', |
| 482 |
'selectors' => [ |
| 483 |
'{{WRAPPER}} .swiper-slide .king-addons-testimonial-carousel-layout' => 'justify-content: {{VALUE}};' |
| 484 |
], |
| 485 |
'condition' => [ |
| 486 |
'king_addons_testimonial_carousel_sw_align_card_full_height' => '100%' |
| 487 |
], |
| 488 |
] |
| 489 |
); |
| 490 |
|
| 491 |
$this->end_controls_section(); |
| 492 |
/** END SECTION: Carousel Settings */ |
| 493 |
|
| 494 |
/** SECTION: Responsive Settings */ |
| 495 |
$this->start_controls_section( |
| 496 |
'king_addons_testimonial_carousel_sw_content_section_responsive_settings', |
| 497 |
[ |
| 498 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Responsive Settings', 'king-addons'), |
| 499 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 500 |
] |
| 501 |
); |
| 502 |
|
| 503 |
$this->add_control( |
| 504 |
'king_addons_testimonial_carousel_sw_desktop_title', |
| 505 |
[ |
| 506 |
'label' => '<b>' . esc_html__('Desktop', 'king-addons') . '</b>', |
| 507 |
'type' => Controls_Manager::RAW_HTML, |
| 508 |
] |
| 509 |
); |
| 510 |
|
| 511 |
$this->add_control( |
| 512 |
'king_addons_testimonial_carousel_sw_desktop_cards_per_view', |
| 513 |
[ |
| 514 |
'label' => esc_html__('Cards per view', 'king-addons'), |
| 515 |
'description' => esc_html__('The number of slides per view can be a fractional number like 4.5, 5.25, 6.45, etc., to indicate that further slides exist.', 'king-addons'), |
| 516 |
'type' => Controls_Manager::NUMBER, |
| 517 |
'min' => 1, |
| 518 |
'step' => 0.1, |
| 519 |
'default' => 3.0, |
| 520 |
] |
| 521 |
); |
| 522 |
|
| 523 |
$this->add_control( |
| 524 |
'king_addons_testimonial_carousel_sw_desktop_space_between_cards', |
| 525 |
[ |
| 526 |
'label' => esc_html__('Space between cards (px)', 'king-addons'), |
| 527 |
'type' => Controls_Manager::NUMBER, |
| 528 |
'min' => 0, |
| 529 |
'step' => 1, |
| 530 |
'default' => 30, |
| 531 |
'separator' => 'after', |
| 532 |
] |
| 533 |
); |
| 534 |
|
| 535 |
$this->add_control( |
| 536 |
'king_addons_testimonial_carousel_sw_tablet_title', |
| 537 |
[ |
| 538 |
'label' => '<b>' . esc_html__('Tablet', 'king-addons') . '</b>', |
| 539 |
'type' => Controls_Manager::RAW_HTML, |
| 540 |
] |
| 541 |
); |
| 542 |
|
| 543 |
$this->add_control( |
| 544 |
'king_addons_testimonial_carousel_sw_tablet_cards_per_view', |
| 545 |
[ |
| 546 |
'label' => esc_html__('Cards per view', 'king-addons'), |
| 547 |
'type' => Controls_Manager::NUMBER, |
| 548 |
'min' => 1, |
| 549 |
'step' => 0.1, |
| 550 |
'default' => 2.0, |
| 551 |
] |
| 552 |
); |
| 553 |
|
| 554 |
$this->add_control( |
| 555 |
'king_addons_testimonial_carousel_sw_tablet_space_between_cards', |
| 556 |
[ |
| 557 |
'label' => esc_html__('Space between cards (px)', 'king-addons'), |
| 558 |
'type' => Controls_Manager::NUMBER, |
| 559 |
'min' => 0, |
| 560 |
'step' => 1, |
| 561 |
'default' => 30, |
| 562 |
'separator' => 'after', |
| 563 |
] |
| 564 |
); |
| 565 |
|
| 566 |
$this->add_control( |
| 567 |
'king_addons_testimonial_carousel_sw_tablet_breakpoint', |
| 568 |
[ |
| 569 |
'label' => esc_html__('Breakpoint (px)', 'king-addons'), |
| 570 |
'type' => Controls_Manager::NUMBER, |
| 571 |
'min' => 1, |
| 572 |
'step' => 1, |
| 573 |
'default' => 1024, |
| 574 |
] |
| 575 |
); |
| 576 |
|
| 577 |
$this->add_control( |
| 578 |
'king_addons_testimonial_carousel_sw_mobile_title', |
| 579 |
[ |
| 580 |
'label' => '<b>' . esc_html__('Mobile', 'king-addons') . '</b>', |
| 581 |
'type' => Controls_Manager::RAW_HTML, |
| 582 |
] |
| 583 |
); |
| 584 |
|
| 585 |
$this->add_control( |
| 586 |
'king_addons_testimonial_carousel_sw_mobile_cards_per_view', |
| 587 |
[ |
| 588 |
'label' => esc_html__('Cards per view', 'king-addons'), |
| 589 |
'type' => Controls_Manager::NUMBER, |
| 590 |
'min' => 1, |
| 591 |
'step' => 0.1, |
| 592 |
'default' => 1.0, |
| 593 |
] |
| 594 |
); |
| 595 |
|
| 596 |
$this->add_control( |
| 597 |
'king_addons_testimonial_carousel_sw_mobile_space_between_cards', |
| 598 |
[ |
| 599 |
'label' => esc_html__('Space between cards (px)', 'king-addons'), |
| 600 |
'type' => Controls_Manager::NUMBER, |
| 601 |
'min' => 0, |
| 602 |
'step' => 1, |
| 603 |
'default' => 30, |
| 604 |
] |
| 605 |
); |
| 606 |
|
| 607 |
$this->add_control( |
| 608 |
'king_addons_testimonial_carousel_sw_mobile_breakpoint', |
| 609 |
[ |
| 610 |
'label' => esc_html__('Breakpoint (px)', 'king-addons'), |
| 611 |
'type' => Controls_Manager::NUMBER, |
| 612 |
'min' => 1, |
| 613 |
'step' => 1, |
| 614 |
'default' => 767, |
| 615 |
] |
| 616 |
); |
| 617 |
|
| 618 |
$this->end_controls_section(); |
| 619 |
/** END SECTION: Responsive Settings */ |
| 620 |
|
| 621 |
/** START SECTION: Navigation */ |
| 622 |
$this->start_controls_section( |
| 623 |
'king_addons_testimonial_carousel_sw_content_section_nav', |
| 624 |
[ |
| 625 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Navigation', 'king-addons'), |
| 626 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 627 |
] |
| 628 |
); |
| 629 |
|
| 630 |
$this->add_control( |
| 631 |
'king_addons_testimonial_carousel_sw_nav_switcher', |
| 632 |
[ |
| 633 |
'label' => esc_html__('Enable navigation', 'king-addons'), |
| 634 |
'type' => Controls_Manager::SWITCHER, |
| 635 |
'default' => 'yes', |
| 636 |
] |
| 637 |
); |
| 638 |
|
| 639 |
$this->add_responsive_control( |
| 640 |
'king_addons_testimonial_carousel_sw_nav_display', |
| 641 |
[ |
| 642 |
'label' => esc_html__('Display on different screen sizes', 'king-addons'), |
| 643 |
'type' => Controls_Manager::SELECT, |
| 644 |
'options' => [ |
| 645 |
'flex' => esc_html__('Show', 'king-addons'), |
| 646 |
'none' => esc_html__('Hide', 'king-addons'), |
| 647 |
], |
| 648 |
'desktop_default' => 'flex', |
| 649 |
'tablet_default' => 'none', |
| 650 |
'mobile_default' => 'none', |
| 651 |
'selectors' => [ |
| 652 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav' => 'display: {{VALUE}};' |
| 653 |
], |
| 654 |
'condition' => [ |
| 655 |
'king_addons_testimonial_carousel_sw_nav_switcher' => 'yes' |
| 656 |
] |
| 657 |
] |
| 658 |
); |
| 659 |
|
| 660 |
$this->end_controls_section(); |
| 661 |
/** END SECTION: Navigation */ |
| 662 |
|
| 663 |
/** START SECTION: Pagination */ |
| 664 |
$this->start_controls_section( |
| 665 |
'king_addons_testimonial_carousel_sw_content_section_pag', |
| 666 |
[ |
| 667 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Pagination', 'king-addons'), |
| 668 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 669 |
] |
| 670 |
); |
| 671 |
|
| 672 |
$this->add_control( |
| 673 |
'king_addons_testimonial_carousel_sw_pag_switcher', |
| 674 |
[ |
| 675 |
'label' => esc_html__('Enable pagination', 'king-addons'), |
| 676 |
'type' => Controls_Manager::SWITCHER, |
| 677 |
'default' => 'yes', |
| 678 |
] |
| 679 |
); |
| 680 |
|
| 681 |
$this->add_control( |
| 682 |
'king_addons_testimonial_carousel_sw_pag_type', |
| 683 |
[ |
| 684 |
'label' => esc_html__('Type', 'king-addons'), |
| 685 |
'type' => Controls_Manager::SELECT, |
| 686 |
'options' => [ |
| 687 |
'bullets' => esc_html__('Bullets', 'king-addons'), |
| 688 |
'progressbar' => esc_html__('Progress Bar', 'king-addons'), |
| 689 |
'fraction' => esc_html__('Fraction', 'king-addons'), |
| 690 |
], |
| 691 |
'default' => 'bullets', |
| 692 |
'condition' => [ |
| 693 |
'king_addons_testimonial_carousel_sw_pag_switcher' => 'yes' |
| 694 |
] |
| 695 |
] |
| 696 |
); |
| 697 |
|
| 698 |
// position top / bottom |
| 699 |
$this->add_responsive_control( |
| 700 |
'king_addons_testimonial_carousel_sw_pag_progressbar_position', |
| 701 |
[ |
| 702 |
'label' => esc_html__('Progress bar position', 'king-addons'), |
| 703 |
'description' => esc_html__('Check margin settings to properly set the position of the progress bar.', 'king-addons'), |
| 704 |
'type' => Controls_Manager::SELECT, |
| 705 |
'options' => [ |
| 706 |
'0' => esc_html__('Top', 'king-addons'), |
| 707 |
'unset' => esc_html__('Bottom', 'king-addons'), |
| 708 |
], |
| 709 |
'default' => 'unset', |
| 710 |
'selectors' => [ |
| 711 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-pagination' => 'top: {{VALUE}}; bottom: 0;' |
| 712 |
], |
| 713 |
'condition' => [ |
| 714 |
'king_addons_testimonial_carousel_sw_pag_type' => 'progressbar', |
| 715 |
] |
| 716 |
] |
| 717 |
); |
| 718 |
|
| 719 |
$this->add_control( |
| 720 |
'king_addons_testimonial_carousel_sw_pag_clickable_switcher', |
| 721 |
[ |
| 722 |
'label' => esc_html__('Clickable Bullets', 'king-addons'), |
| 723 |
'type' => Controls_Manager::SWITCHER, |
| 724 |
'default' => 'yes', |
| 725 |
'condition' => [ |
| 726 |
'king_addons_testimonial_carousel_sw_pag_type' => 'bullets', |
| 727 |
] |
| 728 |
] |
| 729 |
); |
| 730 |
|
| 731 |
$this->add_control( |
| 732 |
'king_addons_testimonial_carousel_sw_pag_dynamic_switcher', |
| 733 |
[ |
| 734 |
'label' => esc_html__('Dynamic Bullets', 'king-addons'), |
| 735 |
'description' => esc_html__('Good to enable if you use bullets pagination with a lot of cards. So it will keep only few bullets visible at the same time.', 'king-addons'), |
| 736 |
'type' => Controls_Manager::SWITCHER, |
| 737 |
'default' => '', |
| 738 |
'condition' => [ |
| 739 |
'king_addons_testimonial_carousel_sw_pag_type' => 'bullets', |
| 740 |
] |
| 741 |
] |
| 742 |
); |
| 743 |
|
| 744 |
$this->add_control( |
| 745 |
'king_addons_testimonial_carousel_sw_pag_dynamic_number', |
| 746 |
[ |
| 747 |
'label' => esc_html__('Number of Dynamic Bullets', 'king-addons'), |
| 748 |
'description' => esc_html__('The number of main bullets visible when Dynamic Bullets enabled.', 'king-addons'), |
| 749 |
'type' => Controls_Manager::NUMBER, |
| 750 |
'min' => 1, |
| 751 |
'step' => 1, |
| 752 |
'default' => 1, |
| 753 |
'condition' => [ |
| 754 |
'king_addons_testimonial_carousel_sw_pag_dynamic_switcher' => 'yes', |
| 755 |
'king_addons_testimonial_carousel_sw_pag_type' => 'bullets', |
| 756 |
] |
| 757 |
] |
| 758 |
); |
| 759 |
|
| 760 |
$this->add_responsive_control( |
| 761 |
'king_addons_testimonial_carousel_sw_pag_display', |
| 762 |
[ |
| 763 |
'label' => esc_html__('Display on different screen sizes', 'king-addons'), |
| 764 |
'type' => Controls_Manager::SELECT, |
| 765 |
'options' => [ |
| 766 |
'block' => esc_html__('Show', 'king-addons'), |
| 767 |
'none' => esc_html__('Hide', 'king-addons'), |
| 768 |
], |
| 769 |
'desktop_default' => 'block', |
| 770 |
'tablet_default' => 'block', |
| 771 |
'mobile_default' => 'block', |
| 772 |
'selectors' => [ |
| 773 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-pagination' => 'display: {{VALUE}};' |
| 774 |
], |
| 775 |
'condition' => [ |
| 776 |
'king_addons_testimonial_carousel_sw_pag_switcher' => 'yes' |
| 777 |
] |
| 778 |
] |
| 779 |
); |
| 780 |
|
| 781 |
$this->end_controls_section(); |
| 782 |
/** END SECTION: Pagination */ |
| 783 |
|
| 784 |
/** ========================================================== */ |
| 785 |
/** ========================================================== */ |
| 786 |
/** ========================================================== */ |
| 787 |
/** STYLES */ |
| 788 |
|
| 789 |
// IMAGE |
| 790 |
$this->start_controls_section( |
| 791 |
'king_addons_testimonial_carousel_section_image_style', |
| 792 |
[ |
| 793 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Image', 'king-addons'), |
| 794 |
'tab' => Controls_Manager::TAB_STYLE, |
| 795 |
] |
| 796 |
); |
| 797 |
|
| 798 |
$this->add_responsive_control( |
| 799 |
'king_addons_testimonial_carousel_image_width', |
| 800 |
[ |
| 801 |
'label' => esc_html__('Width (px)', 'king-addons'), |
| 802 |
'type' => Controls_Manager::NUMBER, |
| 803 |
'min' => 0, |
| 804 |
'step' => 1, |
| 805 |
'default' => 70, |
| 806 |
'selectors' => [ |
| 807 |
'{{WRAPPER}} .king-addons-testimonial-carousel-image img' => 'width: {{SIZE}}px;', |
| 808 |
'{{WRAPPER}} .king-addons-testimonial-carousel-layout-4 .king-addons-testimonial-carousel-image' => 'flex: 0 0 {{SIZE}}px;', |
| 809 |
], |
| 810 |
] |
| 811 |
); |
| 812 |
|
| 813 |
$this->add_responsive_control( |
| 814 |
'king_addons_testimonial_carousel_image_height', |
| 815 |
[ |
| 816 |
'label' => esc_html__('Height (px)', 'king-addons'), |
| 817 |
'type' => Controls_Manager::NUMBER, |
| 818 |
'min' => 0, |
| 819 |
'step' => 1, |
| 820 |
'default' => 70, |
| 821 |
'selectors' => [ |
| 822 |
'{{WRAPPER}} .king-addons-testimonial-carousel-image img' => 'height: {{SIZE}}px;' |
| 823 |
], |
| 824 |
] |
| 825 |
); |
| 826 |
|
| 827 |
$this->add_responsive_control( |
| 828 |
'king_addons_testimonial_carousel_whole_testimonial_carousel_gap', |
| 829 |
[ |
| 830 |
'label' => esc_html__('Gap between Image and Content (px)', 'king-addons'), |
| 831 |
'type' => Controls_Manager::NUMBER, |
| 832 |
'min' => 0, |
| 833 |
'step' => 1, |
| 834 |
'default' => 20, |
| 835 |
'selectors' => [ |
| 836 |
'{{WRAPPER}} .king-addons-testimonial-carousel-layout-4, |
| 837 |
{{WRAPPER}} .king-addons-testimonial-carousel-layout-5' => 'gap: {{SIZE}}px;' |
| 838 |
], |
| 839 |
'condition' => [ |
| 840 |
'king_addons_testimonial_carousel_layout' => ['layout-4', 'layout-5'] |
| 841 |
], |
| 842 |
] |
| 843 |
); |
| 844 |
|
| 845 |
$this->add_responsive_control( |
| 846 |
'king_addons_testimonial_carousel_whole_testimonial_carousel_gap_2', |
| 847 |
[ |
| 848 |
'label' => esc_html__('Gap between Image and Content (px)', 'king-addons'), |
| 849 |
'type' => Controls_Manager::NUMBER, |
| 850 |
'min' => 0, |
| 851 |
'step' => 1, |
| 852 |
'default' => 15, |
| 853 |
'selectors' => [ |
| 854 |
'{{WRAPPER}} .king-addons-testimonial-carousel-layout-1, |
| 855 |
{{WRAPPER}} .king-addons-testimonial-carousel-layout-2, |
| 856 |
{{WRAPPER}} .king-addons-testimonial-carousel-layout-3, |
| 857 |
{{WRAPPER}} .king-addons-testimonial-carousel-layout-8' => 'gap: {{SIZE}}px;' |
| 858 |
], |
| 859 |
'condition' => [ |
| 860 |
'king_addons_testimonial_carousel_layout' => ['layout-1', 'layout-2', 'layout-3', 'layout-8'] |
| 861 |
], |
| 862 |
] |
| 863 |
); |
| 864 |
|
| 865 |
$this->add_group_control( |
| 866 |
Group_Control_Css_Filter::get_type(), |
| 867 |
[ |
| 868 |
'label' => esc_html__('CSS Filter', 'king-addons'), |
| 869 |
'name' => 'king_addons_testimonial_carousel_image_css_filters', |
| 870 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-image img', |
| 871 |
] |
| 872 |
); |
| 873 |
|
| 874 |
$this->add_group_control( |
| 875 |
Group_Control_Box_Shadow::get_type(), |
| 876 |
[ |
| 877 |
'name' => 'king_addons_testimonial_carousel_image_box_shadow', |
| 878 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-image img', |
| 879 |
] |
| 880 |
); |
| 881 |
|
| 882 |
$this->add_group_control( |
| 883 |
Group_Control_Border::get_type(), |
| 884 |
[ |
| 885 |
'name' => 'king_addons_testimonial_carousel_image_border', |
| 886 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-image img', |
| 887 |
'fields_options' => [ |
| 888 |
'border' => [ |
| 889 |
'default' => 'none', |
| 890 |
], |
| 891 |
], |
| 892 |
] |
| 893 |
); |
| 894 |
|
| 895 |
$this->add_responsive_control( |
| 896 |
'king_addons_testimonial_carousel_image_border_radius', |
| 897 |
[ |
| 898 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 899 |
'type' => Controls_Manager::DIMENSIONS, |
| 900 |
'size_units' => ['px', '%'], |
| 901 |
'default' => [ |
| 902 |
'top' => 100, |
| 903 |
'right' => 100, |
| 904 |
'bottom' => 100, |
| 905 |
'left' => 100, |
| 906 |
'unit' => '%', |
| 907 |
], |
| 908 |
'selectors' => [ |
| 909 |
'{{WRAPPER}} .king-addons-testimonial-carousel-image img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 910 |
] |
| 911 |
] |
| 912 |
); |
| 913 |
|
| 914 |
$this->end_controls_section(); |
| 915 |
|
| 916 |
// TITLE |
| 917 |
$this->start_controls_section( |
| 918 |
'king_addons_testimonial_carousel_section_title_style', |
| 919 |
[ |
| 920 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Title', 'king-addons'), |
| 921 |
'tab' => Controls_Manager::TAB_STYLE, |
| 922 |
] |
| 923 |
); |
| 924 |
|
| 925 |
// title - typography |
| 926 |
$this->add_group_control( |
| 927 |
Group_Control_Typography::get_type(), |
| 928 |
[ |
| 929 |
'label' => esc_html__('Typography', 'king-addons'), |
| 930 |
'name' => 'king_addons_testimonial_carousel_title_typography', |
| 931 |
'fields_options' => [ |
| 932 |
'font_size' => [ |
| 933 |
'default' => [ |
| 934 |
'size' => 18, |
| 935 |
'unit' => 'px' |
| 936 |
], |
| 937 |
], |
| 938 |
'font_weight' => [ |
| 939 |
'default' => 600, |
| 940 |
], |
| 941 |
'typography' => [ |
| 942 |
'default' => 'custom', |
| 943 |
] |
| 944 |
], |
| 945 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-title', |
| 946 |
] |
| 947 |
); |
| 948 |
|
| 949 |
// title - color |
| 950 |
$this->add_control( |
| 951 |
'king_addons_testimonial_carousel_title_color', |
| 952 |
[ |
| 953 |
'label' => esc_html__('Color', 'king-addons'), |
| 954 |
'type' => Controls_Manager::COLOR, |
| 955 |
'default' => '#000000', |
| 956 |
'selectors' => [ |
| 957 |
'{{WRAPPER}} .king-addons-testimonial-carousel-title' => 'color: {{VALUE}};', |
| 958 |
], |
| 959 |
] |
| 960 |
); |
| 961 |
|
| 962 |
// title - margin |
| 963 |
$this->add_responsive_control( |
| 964 |
'king_addons_testimonial_carousel_title_margin', |
| 965 |
[ |
| 966 |
'label' => esc_html__('Margin', 'king-addons'), |
| 967 |
'type' => Controls_Manager::DIMENSIONS, |
| 968 |
'size_units' => ['px', 'em', '%'], |
| 969 |
'default' => [ |
| 970 |
'top' => 0, |
| 971 |
'right' => 5, |
| 972 |
'bottom' => 0, |
| 973 |
'left' => 0, |
| 974 |
'unit' => 'px', |
| 975 |
], |
| 976 |
'selectors' => [ |
| 977 |
'{{WRAPPER}} .king-addons-testimonial-carousel-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 978 |
] |
| 979 |
] |
| 980 |
); |
| 981 |
|
| 982 |
$this->end_controls_section(); |
| 983 |
|
| 984 |
$this->start_controls_section( |
| 985 |
'king_addons_testimonial_carousel_section_subtitle_style', |
| 986 |
[ |
| 987 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Subtitle', 'king-addons'), |
| 988 |
'tab' => Controls_Manager::TAB_STYLE, |
| 989 |
] |
| 990 |
); |
| 991 |
|
| 992 |
// subtitle - typography |
| 993 |
$this->add_group_control( |
| 994 |
Group_Control_Typography::get_type(), |
| 995 |
[ |
| 996 |
'label' => esc_html__('Typography', 'king-addons'), |
| 997 |
'name' => 'king_addons_testimonial_carousel_subtitle_typography', |
| 998 |
'fields_options' => [ |
| 999 |
'font_size' => [ |
| 1000 |
'default' => [ |
| 1001 |
'size' => 15, |
| 1002 |
'unit' => 'px' |
| 1003 |
], |
| 1004 |
], |
| 1005 |
'font_weight' => [ |
| 1006 |
'default' => 400, |
| 1007 |
], |
| 1008 |
'typography' => [ |
| 1009 |
'default' => 'custom', |
| 1010 |
] |
| 1011 |
], |
| 1012 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-subtitle', |
| 1013 |
] |
| 1014 |
); |
| 1015 |
|
| 1016 |
// subtitle - color |
| 1017 |
$this->add_control( |
| 1018 |
'king_addons_testimonial_carousel_subtitle_color', |
| 1019 |
[ |
| 1020 |
'label' => esc_html__('Color', 'king-addons'), |
| 1021 |
'type' => Controls_Manager::COLOR, |
| 1022 |
'default' => '#888888', |
| 1023 |
'selectors' => [ |
| 1024 |
'{{WRAPPER}} .king-addons-testimonial-carousel-subtitle' => 'color: {{VALUE}};', |
| 1025 |
], |
| 1026 |
] |
| 1027 |
); |
| 1028 |
|
| 1029 |
// subtitle - margin |
| 1030 |
$this->add_responsive_control( |
| 1031 |
'king_addons_testimonial_carousel_subtitle_margin', |
| 1032 |
[ |
| 1033 |
'label' => esc_html__('Margin', 'king-addons'), |
| 1034 |
'type' => Controls_Manager::DIMENSIONS, |
| 1035 |
'size_units' => ['px', 'em', '%'], |
| 1036 |
'default' => [ |
| 1037 |
'top' => 0, |
| 1038 |
'right' => 0, |
| 1039 |
'bottom' => 0, |
| 1040 |
'left' => 0, |
| 1041 |
'unit' => 'px', |
| 1042 |
], |
| 1043 |
'selectors' => [ |
| 1044 |
'{{WRAPPER}} .king-addons-testimonial-carousel-subtitle' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1045 |
] |
| 1046 |
] |
| 1047 |
); |
| 1048 |
|
| 1049 |
// subtitle - margin |
| 1050 |
$this->add_responsive_control( |
| 1051 |
'king_addons_testimonial_carousel_title_subtitle_margin', |
| 1052 |
[ |
| 1053 |
'label' => esc_html__('Title-Subtitle Block Margin', 'king-addons'), |
| 1054 |
'type' => Controls_Manager::DIMENSIONS, |
| 1055 |
'size_units' => ['px', 'em', '%'], |
| 1056 |
'default' => [ |
| 1057 |
'top' => 0, |
| 1058 |
'right' => 0, |
| 1059 |
'bottom' => 15, |
| 1060 |
'left' => 0, |
| 1061 |
'unit' => 'px', |
| 1062 |
], |
| 1063 |
'selectors' => [ |
| 1064 |
'{{WRAPPER}} .king-addons-testimonial-carousel-person-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1065 |
], |
| 1066 |
'separator' => 'before', |
| 1067 |
'condition' => [ |
| 1068 |
'king_addons_testimonial_carousel_layout' => ['layout-2'] |
| 1069 |
], |
| 1070 |
] |
| 1071 |
); |
| 1072 |
|
| 1073 |
$this->add_responsive_control( |
| 1074 |
'king_addons_testimonial_carousel_title_subtitle_margin_2', |
| 1075 |
[ |
| 1076 |
'label' => esc_html__('Title-Subtitle Block Margin', 'king-addons'), |
| 1077 |
'type' => Controls_Manager::DIMENSIONS, |
| 1078 |
'size_units' => ['px', 'em', '%'], |
| 1079 |
'default' => [ |
| 1080 |
'top' => 0, |
| 1081 |
'right' => 0, |
| 1082 |
'bottom' => 10, |
| 1083 |
'left' => 0, |
| 1084 |
'unit' => 'px', |
| 1085 |
], |
| 1086 |
'selectors' => [ |
| 1087 |
'{{WRAPPER}} .king-addons-testimonial-carousel-person-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1088 |
], |
| 1089 |
'separator' => 'before', |
| 1090 |
'condition' => [ |
| 1091 |
'king_addons_testimonial_carousel_layout' => ['layout-6', 'layout-7'] |
| 1092 |
], |
| 1093 |
] |
| 1094 |
); |
| 1095 |
|
| 1096 |
$this->end_controls_section(); |
| 1097 |
|
| 1098 |
$this->start_controls_section( |
| 1099 |
'king_addons_testimonial_carousel_section_description_style', |
| 1100 |
[ |
| 1101 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Description', 'king-addons'), |
| 1102 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1103 |
] |
| 1104 |
); |
| 1105 |
|
| 1106 |
// description - typography |
| 1107 |
$this->add_group_control( |
| 1108 |
Group_Control_Typography::get_type(), |
| 1109 |
[ |
| 1110 |
'label' => esc_html__('Typography', 'king-addons'), |
| 1111 |
'name' => 'king_addons_testimonial_carousel_description_typography', |
| 1112 |
'fields_options' => [ |
| 1113 |
'font_size' => [ |
| 1114 |
'default' => [ |
| 1115 |
'size' => 16, |
| 1116 |
'unit' => 'px' |
| 1117 |
], |
| 1118 |
], |
| 1119 |
'font_weight' => [ |
| 1120 |
'default' => 400, |
| 1121 |
], |
| 1122 |
'typography' => [ |
| 1123 |
'default' => 'custom', |
| 1124 |
] |
| 1125 |
], |
| 1126 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-description', |
| 1127 |
] |
| 1128 |
); |
| 1129 |
|
| 1130 |
// description - color |
| 1131 |
$this->add_control( |
| 1132 |
'king_addons_testimonial_carousel_description_color', |
| 1133 |
[ |
| 1134 |
'label' => esc_html__('Color', 'king-addons'), |
| 1135 |
'type' => Controls_Manager::COLOR, |
| 1136 |
'default' => '#000000', |
| 1137 |
'selectors' => [ |
| 1138 |
'{{WRAPPER}} .king-addons-testimonial-carousel-description' => 'color: {{VALUE}};', |
| 1139 |
], |
| 1140 |
] |
| 1141 |
); |
| 1142 |
|
| 1143 |
// description - margin |
| 1144 |
$this->add_responsive_control( |
| 1145 |
'king_addons_testimonial_carousel_description_margin', |
| 1146 |
[ |
| 1147 |
'label' => esc_html__('Margin', 'king-addons'), |
| 1148 |
'type' => Controls_Manager::DIMENSIONS, |
| 1149 |
'size_units' => ['px', 'em', '%'], |
| 1150 |
'default' => [ |
| 1151 |
'top' => 0, |
| 1152 |
'right' => 0, |
| 1153 |
'bottom' => 10, |
| 1154 |
'left' => 0, |
| 1155 |
'unit' => 'px', |
| 1156 |
], |
| 1157 |
'selectors' => [ |
| 1158 |
'{{WRAPPER}} .king-addons-testimonial-carousel-description' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1159 |
], |
| 1160 |
'condition' => [ |
| 1161 |
'king_addons_testimonial_carousel_layout' => ['layout-1', 'layout-2', 'layout-3', 'layout-4', 'layout-5', 'layout-8'] |
| 1162 |
], |
| 1163 |
] |
| 1164 |
); |
| 1165 |
|
| 1166 |
$this->end_controls_section(); |
| 1167 |
|
| 1168 |
// STYLE: RATING ============================================ |
| 1169 |
$this->start_controls_section( |
| 1170 |
'king_addons_testimonial_carousel_section_icon_style', |
| 1171 |
[ |
| 1172 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Rating', 'king-addons'), |
| 1173 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1174 |
] |
| 1175 |
); |
| 1176 |
|
| 1177 |
$this->add_responsive_control( |
| 1178 |
'king_addons_testimonial_carousel_icon_size', |
| 1179 |
[ |
| 1180 |
'label' => esc_html__('Size', 'king-addons'), |
| 1181 |
'type' => Controls_Manager::SLIDER, |
| 1182 |
'size_units' => ['px', 'em', 'rem', 'vw', 'custom'], |
| 1183 |
'range' => [ |
| 1184 |
'px' => [ |
| 1185 |
'max' => 100, |
| 1186 |
], |
| 1187 |
'em' => [ |
| 1188 |
'min' => 0, |
| 1189 |
'max' => 10, |
| 1190 |
], |
| 1191 |
'rem' => [ |
| 1192 |
'min' => 0, |
| 1193 |
'max' => 10, |
| 1194 |
], |
| 1195 |
], |
| 1196 |
'selectors' => [ |
| 1197 |
'{{WRAPPER}} .king-addons-testimonial-carousel-rating-general' => '--king-addons-testimonial-carousel-rating-icon-font-size: {{SIZE}}{{UNIT}}', |
| 1198 |
], |
| 1199 |
] |
| 1200 |
); |
| 1201 |
|
| 1202 |
$this->add_responsive_control( |
| 1203 |
'king_addons_testimonial_carousel_icon_gap', |
| 1204 |
[ |
| 1205 |
'label' => esc_html__('Spacing', 'king-addons'), |
| 1206 |
'type' => Controls_Manager::SLIDER, |
| 1207 |
'size_units' => ['px', 'em', 'rem', 'vw', 'custom'], |
| 1208 |
'range' => [ |
| 1209 |
'px' => [ |
| 1210 |
'max' => 100, |
| 1211 |
], |
| 1212 |
'em' => [ |
| 1213 |
'min' => 0, |
| 1214 |
'max' => 10, |
| 1215 |
], |
| 1216 |
'rem' => [ |
| 1217 |
'min' => 0, |
| 1218 |
'max' => 10, |
| 1219 |
], |
| 1220 |
], |
| 1221 |
'selectors' => [ |
| 1222 |
'{{WRAPPER}} .king-addons-testimonial-carousel-rating-general' => '--king-addons-testimonial-carousel-rating-gap: {{SIZE}}{{UNIT}}', |
| 1223 |
], |
| 1224 |
] |
| 1225 |
); |
| 1226 |
|
| 1227 |
$this->add_control( |
| 1228 |
'king_addons_testimonial_carousel_icon_color', |
| 1229 |
[ |
| 1230 |
'label' => esc_html__('Color', 'king-addons'), |
| 1231 |
'type' => Controls_Manager::COLOR, |
| 1232 |
'selectors' => [ |
| 1233 |
'{{WRAPPER}} .king-addons-testimonial-carousel-rating-general' => '--king-addons-testimonial-carousel-rating-icon-marked-color: {{VALUE}}', |
| 1234 |
], |
| 1235 |
'separator' => 'before', |
| 1236 |
] |
| 1237 |
); |
| 1238 |
|
| 1239 |
$this->add_control( |
| 1240 |
'king_addons_testimonial_carousel_icon_unmarked_color', |
| 1241 |
[ |
| 1242 |
'label' => esc_html__('Unmarked Color', 'king-addons'), |
| 1243 |
'type' => Controls_Manager::COLOR, |
| 1244 |
'selectors' => [ |
| 1245 |
'{{WRAPPER}} .king-addons-testimonial-carousel-rating-general' => '--king-addons-testimonial-carousel-rating-icon-color: {{VALUE}}', |
| 1246 |
], |
| 1247 |
] |
| 1248 |
); |
| 1249 |
|
| 1250 |
// rating - margin |
| 1251 |
$this->add_responsive_control( |
| 1252 |
'king_addons_testimonial_carousel_icon_margin', |
| 1253 |
[ |
| 1254 |
'label' => esc_html__('Margin', 'king-addons'), |
| 1255 |
'type' => Controls_Manager::DIMENSIONS, |
| 1256 |
'size_units' => ['px', '%'], |
| 1257 |
'default' => [ |
| 1258 |
'top' => 0, |
| 1259 |
'right' => 0, |
| 1260 |
'bottom' => 10, |
| 1261 |
'left' => 0, |
| 1262 |
'unit' => 'px', |
| 1263 |
], |
| 1264 |
'selectors' => [ |
| 1265 |
'{{WRAPPER}} .king-addons-testimonial-carousel-rating-general' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1266 |
], |
| 1267 |
'condition' => [ |
| 1268 |
'king_addons_testimonial_carousel_layout' => ['layout-1', 'layout-2', 'layout-4', 'layout-5', 'layout-8'] |
| 1269 |
], |
| 1270 |
] |
| 1271 |
); |
| 1272 |
|
| 1273 |
$this->end_controls_section(); |
| 1274 |
// END: RATING ============================================ |
| 1275 |
|
| 1276 |
$this->start_controls_section( |
| 1277 |
'king_addons_testimonial_carousel_section_whole_testimonial_carousel_style', |
| 1278 |
[ |
| 1279 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Testimonial Card', 'king-addons'), |
| 1280 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1281 |
] |
| 1282 |
); |
| 1283 |
|
| 1284 |
|
| 1285 |
$this->add_group_control( |
| 1286 |
Group_Control_Background::get_type(), |
| 1287 |
[ |
| 1288 |
'name' => 'king_addons_testimonial_carousel_whole_testimonial_carousel_bg', |
| 1289 |
'fields_options' => [ |
| 1290 |
'color' => [ |
| 1291 |
'default' => '#FFFFFF', |
| 1292 |
], |
| 1293 |
'background' => [ |
| 1294 |
'default' => 'classic', |
| 1295 |
] |
| 1296 |
], |
| 1297 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-layout' |
| 1298 |
] |
| 1299 |
); |
| 1300 |
|
| 1301 |
$this->add_responsive_control( |
| 1302 |
'king_addons_testimonial_carousel_whole_testimonial_carousel_gap_3', |
| 1303 |
[ |
| 1304 |
'label' => esc_html__('Space between Bio and Description (px)', 'king-addons'), |
| 1305 |
'type' => Controls_Manager::NUMBER, |
| 1306 |
'min' => 0, |
| 1307 |
'step' => 1, |
| 1308 |
'default' => 25, |
| 1309 |
'separator' => 'before', |
| 1310 |
'selectors' => [ |
| 1311 |
'{{WRAPPER}} .king-addons-testimonial-carousel-layout-6, |
| 1312 |
{{WRAPPER}} .king-addons-testimonial-carousel-layout-7' => 'gap: {{SIZE}}px;' |
| 1313 |
], |
| 1314 |
'condition' => [ |
| 1315 |
'king_addons_testimonial_carousel_layout' => ['layout-6', 'layout-7'] |
| 1316 |
], |
| 1317 |
] |
| 1318 |
); |
| 1319 |
|
| 1320 |
$this->add_responsive_control( |
| 1321 |
'king_addons_testimonial_carousel_whole_testimonial_carousel_gap_4', |
| 1322 |
[ |
| 1323 |
'label' => esc_html__('Space between Image and Title + Subtitle, Rating (px)', 'king-addons'), |
| 1324 |
'type' => Controls_Manager::NUMBER, |
| 1325 |
'min' => 0, |
| 1326 |
'step' => 1, |
| 1327 |
'default' => 20, |
| 1328 |
'selectors' => [ |
| 1329 |
'{{WRAPPER}} .king-addons-testimonial-carousel-layout-6 .king-addons-testimonial-carousel-content, |
| 1330 |
{{WRAPPER}} .king-addons-testimonial-carousel-layout-7 .king-addons-testimonial-carousel-content' => 'gap: {{SIZE}}px;' |
| 1331 |
], |
| 1332 |
'condition' => [ |
| 1333 |
'king_addons_testimonial_carousel_layout' => ['layout-6', 'layout-7'] |
| 1334 |
], |
| 1335 |
] |
| 1336 |
); |
| 1337 |
|
| 1338 |
$this->add_responsive_control( |
| 1339 |
'king_addons_testimonial_carousel_whole_testimonial_carousel_padding', |
| 1340 |
[ |
| 1341 |
'label' => esc_html__('Padding', 'king-addons'), |
| 1342 |
'type' => Controls_Manager::DIMENSIONS, |
| 1343 |
'size_units' => ['px', '%'], |
| 1344 |
'default' => [ |
| 1345 |
'top' => 30, |
| 1346 |
'right' => 30, |
| 1347 |
'bottom' => 30, |
| 1348 |
'left' => 30, |
| 1349 |
'unit' => 'px', |
| 1350 |
], |
| 1351 |
'separator' => 'before', |
| 1352 |
'selectors' => [ |
| 1353 |
'{{WRAPPER}} .king-addons-testimonial-carousel-layout' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1354 |
] |
| 1355 |
] |
| 1356 |
); |
| 1357 |
|
| 1358 |
// $this->add_responsive_control( |
| 1359 |
// 'king_addons_testimonial_carousel_whole_testimonial_carousel_margin', |
| 1360 |
// [ |
| 1361 |
// 'label' => esc_html__('Margin', 'king-addons'), |
| 1362 |
// 'type' => Controls_Manager::DIMENSIONS, |
| 1363 |
// 'size_units' => ['px', '%'], |
| 1364 |
// 'default' => [ |
| 1365 |
// 'top' => 0, |
| 1366 |
// 'right' => 0, |
| 1367 |
// 'bottom' => 0, |
| 1368 |
// 'left' => 0, |
| 1369 |
// 'unit' => 'px', |
| 1370 |
// ], |
| 1371 |
// 'selectors' => [ |
| 1372 |
// '{{WRAPPER}} .king-addons-testimonial-carousel-layout' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1373 |
// ] |
| 1374 |
// ] |
| 1375 |
// ); |
| 1376 |
|
| 1377 |
$this->add_group_control( |
| 1378 |
Group_Control_Box_Shadow::get_type(), |
| 1379 |
[ |
| 1380 |
'name' => 'king_addons_testimonial_carousel_whole_testimonial_carousel_box_shadow', |
| 1381 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-layout', |
| 1382 |
'fields_options' => [ |
| 1383 |
'box_shadow' => [ |
| 1384 |
'default' => [ |
| 1385 |
'horizontal' => 0, |
| 1386 |
'vertical' => 3, |
| 1387 |
'blur' => 10, |
| 1388 |
'spread' => 0, |
| 1389 |
'color' => 'rgba(36, 36, 36, 0.1)', |
| 1390 |
], |
| 1391 |
], |
| 1392 |
'box_shadow_type' => [ |
| 1393 |
'default' => 'yes', |
| 1394 |
], |
| 1395 |
], |
| 1396 |
] |
| 1397 |
); |
| 1398 |
|
| 1399 |
$this->add_group_control( |
| 1400 |
Group_Control_Border::get_type(), |
| 1401 |
[ |
| 1402 |
'name' => 'king_addons_testimonial_carousel_whole_testimonial_carousel_border', |
| 1403 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-layout', |
| 1404 |
'fields_options' => [ |
| 1405 |
'border' => [ |
| 1406 |
'default' => 'none', |
| 1407 |
], |
| 1408 |
], |
| 1409 |
] |
| 1410 |
); |
| 1411 |
|
| 1412 |
$this->add_responsive_control( |
| 1413 |
'king_addons_testimonial_carousel_whole_testimonial_carousel_border_radius', |
| 1414 |
[ |
| 1415 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 1416 |
'type' => Controls_Manager::DIMENSIONS, |
| 1417 |
'size_units' => ['px', '%'], |
| 1418 |
'default' => [ |
| 1419 |
'top' => 8, |
| 1420 |
'right' => 8, |
| 1421 |
'bottom' => 8, |
| 1422 |
'left' => 8, |
| 1423 |
'unit' => 'px', |
| 1424 |
], |
| 1425 |
'selectors' => [ |
| 1426 |
'{{WRAPPER}} .king-addons-testimonial-carousel-layout' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1427 |
] |
| 1428 |
] |
| 1429 |
); |
| 1430 |
|
| 1431 |
$this->end_controls_section(); |
| 1432 |
|
| 1433 |
/** START SECTION: Navigation */ |
| 1434 |
$this->start_controls_section( |
| 1435 |
'king_addons_testimonial_carousel_sw_style_section_nav', |
| 1436 |
[ |
| 1437 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Navigation', 'king-addons'), |
| 1438 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1439 |
] |
| 1440 |
); |
| 1441 |
|
| 1442 |
$this->add_control( |
| 1443 |
'king_addons_testimonial_carousel_sw_nav_icon_prev_title', |
| 1444 |
[ |
| 1445 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Previous button', 'king-addons'), |
| 1446 |
'type' => Controls_Manager::HEADING, |
| 1447 |
] |
| 1448 |
); |
| 1449 |
|
| 1450 |
$this->add_control( |
| 1451 |
'king_addons_testimonial_carousel_sw_nav_icon_prev', |
| 1452 |
[ |
| 1453 |
'label' => esc_html__('Icon', 'king-addons'), |
| 1454 |
'type' => Controls_Manager::ICONS, |
| 1455 |
'skin' => 'inline', |
| 1456 |
'label_block' => false, |
| 1457 |
'default' => [ |
| 1458 |
'value' => 'fas fa-chevron-left', |
| 1459 |
'library' => 'fa-solid', |
| 1460 |
], |
| 1461 |
] |
| 1462 |
); |
| 1463 |
|
| 1464 |
$this->add_responsive_control( |
| 1465 |
'king_addons_testimonial_carousel_sw_nav_margin_prev', |
| 1466 |
[ |
| 1467 |
'label' => esc_html__('Margin', 'king-addons'), |
| 1468 |
'type' => Controls_Manager::DIMENSIONS, |
| 1469 |
'size_units' => ['px'], |
| 1470 |
'default' => [ |
| 1471 |
'top' => 0, |
| 1472 |
'right' => 0, |
| 1473 |
'bottom' => 0, |
| 1474 |
'left' => 0, |
| 1475 |
'unit' => 'px', |
| 1476 |
'isLinked' => false |
| 1477 |
], |
| 1478 |
'selectors' => [ |
| 1479 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-prev .king-addons-testimonial-carousel-sw-nav-inner' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1480 |
] |
| 1481 |
] |
| 1482 |
); |
| 1483 |
|
| 1484 |
|
| 1485 |
$this->add_responsive_control( |
| 1486 |
'king_addons_testimonial_carousel_sw_nav_prev_transform_scale', |
| 1487 |
[ |
| 1488 |
'label' => esc_html__('Scale on hover (%)', 'king-addons'), |
| 1489 |
'type' => Controls_Manager::NUMBER, |
| 1490 |
'step' => 0.1, |
| 1491 |
'min' => 0, |
| 1492 |
'default' => 1.3, |
| 1493 |
'selectors' => [ |
| 1494 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-prev:hover .king-addons-testimonial-carousel-sw-nav-inner' => 'transform: scale({{VALUE}});', |
| 1495 |
], |
| 1496 |
] |
| 1497 |
); |
| 1498 |
|
| 1499 |
$this->add_responsive_control( |
| 1500 |
'king_addons_testimonial_carousel_sw_nav_position_v_prev', |
| 1501 |
[ |
| 1502 |
'type' => Controls_Manager::SLIDER, |
| 1503 |
'label' => esc_html__('Vertical position (%)', 'king-addons'), |
| 1504 |
'size_units' => ['%'], |
| 1505 |
'range' => [ |
| 1506 |
'%' => [ |
| 1507 |
'min' => 0, |
| 1508 |
'max' => 100, |
| 1509 |
], |
| 1510 |
], |
| 1511 |
'default' => [ |
| 1512 |
'unit' => '%', |
| 1513 |
'size' => 50, |
| 1514 |
], |
| 1515 |
'selectors' => [ |
| 1516 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-prev' => 'top: {{SIZE}}{{UNIT}};', |
| 1517 |
], |
| 1518 |
] |
| 1519 |
); |
| 1520 |
|
| 1521 |
$this->add_responsive_control( |
| 1522 |
'king_addons_testimonial_carousel_sw_nav_position_h_prev', |
| 1523 |
[ |
| 1524 |
'type' => Controls_Manager::SLIDER, |
| 1525 |
'label' => esc_html__('Horizontal position (%)', 'king-addons'), |
| 1526 |
'size_units' => ['%'], |
| 1527 |
'range' => [ |
| 1528 |
'%' => [ |
| 1529 |
'min' => 0, |
| 1530 |
'max' => 100, |
| 1531 |
], |
| 1532 |
], |
| 1533 |
'default' => [ |
| 1534 |
'unit' => '%', |
| 1535 |
'size' => 0, |
| 1536 |
], |
| 1537 |
'selectors' => [ |
| 1538 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-prev' => 'left: {{SIZE}}{{UNIT}};', |
| 1539 |
], |
| 1540 |
] |
| 1541 |
); |
| 1542 |
|
| 1543 |
$this->add_control( |
| 1544 |
'king_addons_testimonial_carousel_sw_nav_icon_next_title', |
| 1545 |
[ |
| 1546 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Next button', 'king-addons'), |
| 1547 |
'type' => Controls_Manager::HEADING, |
| 1548 |
'separator' => 'before', |
| 1549 |
] |
| 1550 |
); |
| 1551 |
|
| 1552 |
$this->add_control( |
| 1553 |
'king_addons_testimonial_carousel_sw_nav_icon_next', |
| 1554 |
[ |
| 1555 |
'label' => esc_html__('Icon', 'king-addons'), |
| 1556 |
'type' => Controls_Manager::ICONS, |
| 1557 |
'skin' => 'inline', |
| 1558 |
'label_block' => false, |
| 1559 |
'default' => [ |
| 1560 |
'value' => 'fas fa-chevron-right', |
| 1561 |
'library' => 'fa-solid', |
| 1562 |
], |
| 1563 |
] |
| 1564 |
); |
| 1565 |
|
| 1566 |
$this->add_responsive_control( |
| 1567 |
'king_addons_testimonial_carousel_sw_nav_margin_next', |
| 1568 |
[ |
| 1569 |
'label' => esc_html__('Margin', 'king-addons'), |
| 1570 |
'type' => Controls_Manager::DIMENSIONS, |
| 1571 |
'size_units' => ['px'], |
| 1572 |
'default' => [ |
| 1573 |
'top' => 0, |
| 1574 |
'right' => 0, |
| 1575 |
'bottom' => 0, |
| 1576 |
'left' => 0, |
| 1577 |
'unit' => 'px', |
| 1578 |
'isLinked' => false |
| 1579 |
], |
| 1580 |
'selectors' => [ |
| 1581 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-next .king-addons-testimonial-carousel-sw-nav-inner' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1582 |
] |
| 1583 |
] |
| 1584 |
); |
| 1585 |
|
| 1586 |
$this->add_responsive_control( |
| 1587 |
'king_addons_testimonial_carousel_sw_nav_next_transform_scale', |
| 1588 |
[ |
| 1589 |
'label' => esc_html__('Scale on hover (%)', 'king-addons'), |
| 1590 |
'type' => Controls_Manager::NUMBER, |
| 1591 |
'step' => 0.1, |
| 1592 |
'min' => 0, |
| 1593 |
'default' => 1.3, |
| 1594 |
'selectors' => [ |
| 1595 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-next:hover .king-addons-testimonial-carousel-sw-nav-inner' => 'transform: scale({{VALUE}});', |
| 1596 |
], |
| 1597 |
] |
| 1598 |
); |
| 1599 |
|
| 1600 |
$this->add_responsive_control( |
| 1601 |
'king_addons_testimonial_carousel_sw_nav_position_v_next', |
| 1602 |
[ |
| 1603 |
'type' => Controls_Manager::SLIDER, |
| 1604 |
'label' => esc_html__('Vertical position (%)', 'king-addons'), |
| 1605 |
'size_units' => ['%'], |
| 1606 |
'range' => [ |
| 1607 |
'%' => [ |
| 1608 |
'min' => 0, |
| 1609 |
'max' => 100, |
| 1610 |
], |
| 1611 |
], |
| 1612 |
'default' => [ |
| 1613 |
'unit' => '%', |
| 1614 |
'size' => 50, |
| 1615 |
], |
| 1616 |
'selectors' => [ |
| 1617 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-next' => 'top: {{SIZE}}{{UNIT}};', |
| 1618 |
], |
| 1619 |
] |
| 1620 |
); |
| 1621 |
|
| 1622 |
$this->add_responsive_control( |
| 1623 |
'king_addons_testimonial_carousel_sw_nav_position_h_next', |
| 1624 |
[ |
| 1625 |
'type' => Controls_Manager::SLIDER, |
| 1626 |
'label' => esc_html__('Horizontal position (%)', 'king-addons'), |
| 1627 |
'size_units' => ['%'], |
| 1628 |
'range' => [ |
| 1629 |
'%' => [ |
| 1630 |
'min' => 0, |
| 1631 |
'max' => 100, |
| 1632 |
], |
| 1633 |
], |
| 1634 |
'default' => [ |
| 1635 |
'unit' => '%', |
| 1636 |
'size' => 100, |
| 1637 |
], |
| 1638 |
'selectors' => [ |
| 1639 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-next' => 'right: calc(100% - {{SIZE}}{{UNIT}});', |
| 1640 |
], |
| 1641 |
] |
| 1642 |
); |
| 1643 |
|
| 1644 |
// common |
| 1645 |
$this->add_control( |
| 1646 |
'king_addons_testimonial_carousel_sw_nav_icon_common_title', |
| 1647 |
[ |
| 1648 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Common settings', 'king-addons'), |
| 1649 |
'type' => Controls_Manager::HEADING, |
| 1650 |
'separator' => 'before', |
| 1651 |
] |
| 1652 |
); |
| 1653 |
|
| 1654 |
$this->add_responsive_control( |
| 1655 |
'king_addons_testimonial_carousel_sw_nav_icon_size', |
| 1656 |
[ |
| 1657 |
'label' => esc_html__('Icon Size', 'king-addons'), |
| 1658 |
'type' => Controls_Manager::NUMBER, |
| 1659 |
'step' => 1, |
| 1660 |
'min' => 0, |
| 1661 |
'default' => 32, |
| 1662 |
'selectors' => [ |
| 1663 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav i' => 'font-size: {{VALUE}}px; width: {{VALUE}}px;', |
| 1664 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav img' => 'width: {{VALUE}}px; height: {{VALUE}}px;', |
| 1665 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav svg' => 'width: {{VALUE}}px; height: {{VALUE}}px;' |
| 1666 |
], |
| 1667 |
] |
| 1668 |
); |
| 1669 |
|
| 1670 |
$this->add_responsive_control( |
| 1671 |
'king_addons_testimonial_carousel_sw_nav_transition_icon', |
| 1672 |
[ |
| 1673 |
'label' => esc_html__('Transition duration for icon on hover (ms)', 'king-addons'), |
| 1674 |
'type' => Controls_Manager::NUMBER, |
| 1675 |
'min' => 0, |
| 1676 |
'step' => 10, |
| 1677 |
'default' => 300, |
| 1678 |
'selectors' => [ |
| 1679 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav i' => 'transition: all {{SIZE}}ms;', |
| 1680 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav img' => 'transition: all {{SIZE}}ms;', |
| 1681 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav svg' => 'transition: all {{SIZE}}ms;', |
| 1682 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav .king-addons-testimonial-carousel-sw-nav-inner' => 'transition: all {{SIZE}}ms;', |
| 1683 |
], |
| 1684 |
] |
| 1685 |
); |
| 1686 |
|
| 1687 |
$this->add_responsive_control( |
| 1688 |
'king_addons_testimonial_carousel_sw_nav_padding', |
| 1689 |
[ |
| 1690 |
'label' => esc_html__('Padding', 'king-addons'), |
| 1691 |
'type' => Controls_Manager::DIMENSIONS, |
| 1692 |
'size_units' => ['px', '%'], |
| 1693 |
'default' => [ |
| 1694 |
'top' => 10, |
| 1695 |
'right' => 10, |
| 1696 |
'bottom' => 10, |
| 1697 |
'left' => 10, |
| 1698 |
'unit' => 'px', |
| 1699 |
], |
| 1700 |
'selectors' => [ |
| 1701 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1702 |
] |
| 1703 |
] |
| 1704 |
); |
| 1705 |
|
| 1706 |
$this->start_controls_tabs('king_addons_testimonial_carousel_sw_nav_tabs'); |
| 1707 |
|
| 1708 |
$this->start_controls_tab( |
| 1709 |
'king_addons_testimonial_carousel_sw_nav_tab_normal', |
| 1710 |
[ |
| 1711 |
'label' => esc_html__('Normal', 'king-addons'), |
| 1712 |
] |
| 1713 |
); |
| 1714 |
|
| 1715 |
$this->add_control( |
| 1716 |
'king_addons_testimonial_carousel_sw_nav_color', |
| 1717 |
[ |
| 1718 |
'label' => esc_html__('Color', 'king-addons'), |
| 1719 |
'type' => Controls_Manager::COLOR, |
| 1720 |
'default' => '#00000033', |
| 1721 |
'selectors' => [ |
| 1722 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav i' => 'color: {{VALUE}};', |
| 1723 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav svg' => 'fill: {{VALUE}};' |
| 1724 |
], |
| 1725 |
] |
| 1726 |
); |
| 1727 |
|
| 1728 |
$this->add_control( |
| 1729 |
'king_addons_testimonial_carousel_sw_nav_bg_color', |
| 1730 |
[ |
| 1731 |
'label' => esc_html__('Background Color', 'king-addons'), |
| 1732 |
'type' => Controls_Manager::COLOR, |
| 1733 |
'default' => '', |
| 1734 |
'selectors' => [ |
| 1735 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-inner' => 'background-color: {{VALUE}}', |
| 1736 |
], |
| 1737 |
] |
| 1738 |
); |
| 1739 |
|
| 1740 |
$this->add_group_control( |
| 1741 |
Group_Control_Box_Shadow::get_type(), |
| 1742 |
[ |
| 1743 |
'name' => 'king_addons_testimonial_carousel_sw_nav_box_shadow', |
| 1744 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-inner', |
| 1745 |
] |
| 1746 |
); |
| 1747 |
|
| 1748 |
$this->add_group_control( |
| 1749 |
Group_Control_Border::get_type(), |
| 1750 |
[ |
| 1751 |
'name' => 'king_addons_testimonial_carousel_sw_nav_border', |
| 1752 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-inner', |
| 1753 |
'fields_options' => [ |
| 1754 |
'border' => [ |
| 1755 |
'default' => 'none', |
| 1756 |
], |
| 1757 |
], |
| 1758 |
] |
| 1759 |
); |
| 1760 |
|
| 1761 |
$this->add_responsive_control( |
| 1762 |
'king_addons_testimonial_carousel_sw_nav_border_radius', |
| 1763 |
[ |
| 1764 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 1765 |
'type' => Controls_Manager::DIMENSIONS, |
| 1766 |
'size_units' => ['px', '%'], |
| 1767 |
'default' => [ |
| 1768 |
'top' => 100, |
| 1769 |
'right' => 100, |
| 1770 |
'bottom' => 100, |
| 1771 |
'left' => 100, |
| 1772 |
'unit' => '%', |
| 1773 |
], |
| 1774 |
'selectors' => [ |
| 1775 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-inner' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1776 |
] |
| 1777 |
] |
| 1778 |
); |
| 1779 |
$this->end_controls_tab(); |
| 1780 |
|
| 1781 |
$this->start_controls_tab( |
| 1782 |
'king_addons_testimonial_carousel_sw_nav_tab_hover', |
| 1783 |
[ |
| 1784 |
'label' => esc_html__('Hover', 'king-addons'), |
| 1785 |
] |
| 1786 |
); |
| 1787 |
|
| 1788 |
$this->add_control( |
| 1789 |
'king_addons_testimonial_carousel_sw_nav_color_hover', |
| 1790 |
[ |
| 1791 |
'label' => esc_html__('Color', 'king-addons'), |
| 1792 |
'type' => Controls_Manager::COLOR, |
| 1793 |
'selectors' => [ |
| 1794 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav i:hover' => 'color: {{VALUE}};', |
| 1795 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav svg:hover' => 'fill: {{VALUE}};' |
| 1796 |
], |
| 1797 |
] |
| 1798 |
); |
| 1799 |
|
| 1800 |
$this->add_control( |
| 1801 |
'king_addons_testimonial_carousel_sw_nav_bg_color_hover', |
| 1802 |
[ |
| 1803 |
'label' => esc_html__('Background Color', 'king-addons'), |
| 1804 |
'type' => Controls_Manager::COLOR, |
| 1805 |
'selectors' => [ |
| 1806 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-inner:hover' => 'background-color: {{VALUE}}', |
| 1807 |
], |
| 1808 |
] |
| 1809 |
); |
| 1810 |
|
| 1811 |
$this->add_group_control( |
| 1812 |
Group_Control_Box_Shadow::get_type(), |
| 1813 |
[ |
| 1814 |
'name' => 'king_addons_testimonial_carousel_sw_nav_box_shadow_hover', |
| 1815 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-inner:hover', |
| 1816 |
] |
| 1817 |
); |
| 1818 |
|
| 1819 |
$this->add_group_control( |
| 1820 |
Group_Control_Border::get_type(), |
| 1821 |
[ |
| 1822 |
'name' => 'king_addons_testimonial_carousel_sw_nav_border_hover', |
| 1823 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-inner:hover', |
| 1824 |
] |
| 1825 |
); |
| 1826 |
|
| 1827 |
$this->add_responsive_control( |
| 1828 |
'king_addons_testimonial_carousel_sw_nav_border_radius_hover', |
| 1829 |
[ |
| 1830 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 1831 |
'type' => Controls_Manager::DIMENSIONS, |
| 1832 |
'size_units' => ['px', '%'], |
| 1833 |
'selectors' => [ |
| 1834 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-nav-inner:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1835 |
] |
| 1836 |
] |
| 1837 |
); |
| 1838 |
|
| 1839 |
$this->end_controls_tab(); |
| 1840 |
|
| 1841 |
$this->end_controls_tabs(); |
| 1842 |
$this->end_controls_section(); |
| 1843 |
/** END SECTION: Navigation */ |
| 1844 |
|
| 1845 |
/** SECTION: Pagination */ |
| 1846 |
$this->start_controls_section( |
| 1847 |
'king_addons_testimonial_carousel_sw_style_section_pag', |
| 1848 |
[ |
| 1849 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Pagination', 'king-addons'), |
| 1850 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1851 |
] |
| 1852 |
); |
| 1853 |
|
| 1854 |
$this->add_control( |
| 1855 |
'king_addons_testimonial_carousel_sw_pag_color', |
| 1856 |
[ |
| 1857 |
'label' => esc_html__('Color', 'king-addons'), |
| 1858 |
'type' => Controls_Manager::COLOR, |
| 1859 |
'default' => '#000000', |
| 1860 |
'selectors' => [ |
| 1861 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-pagination' => '--swiper-theme-color: {{VALUE}}; --swiper-pagination-fraction-color: {{VALUE}};', |
| 1862 |
], |
| 1863 |
] |
| 1864 |
); |
| 1865 |
|
| 1866 |
$this->add_control( |
| 1867 |
'king_addons_testimonial_carousel_sw_pag_color_second', |
| 1868 |
[ |
| 1869 |
'label' => esc_html__('Second Color', 'king-addons'), |
| 1870 |
'type' => Controls_Manager::COLOR, |
| 1871 |
'default' => '#00000033', |
| 1872 |
'selectors' => [ |
| 1873 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-pagination' => '--swiper-pagination-progressbar-bg-color: {{VALUE}}; --swiper-pagination-bullet-inactive-color: {{VALUE}}; --swiper-pagination-bullet-inactive-opacity: 1;', |
| 1874 |
], |
| 1875 |
] |
| 1876 |
); |
| 1877 |
|
| 1878 |
$this->add_control( |
| 1879 |
'king_addons_testimonial_carousel_sw_pag_bullets_title', |
| 1880 |
[ |
| 1881 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Bullets type', 'king-addons'), |
| 1882 |
'type' => Controls_Manager::HEADING, |
| 1883 |
'separator' => 'before', |
| 1884 |
] |
| 1885 |
); |
| 1886 |
|
| 1887 |
$this->add_responsive_control( |
| 1888 |
'king_addons_testimonial_carousel_sw_pag_bullets_size', |
| 1889 |
[ |
| 1890 |
'label' => esc_html__('Size', 'king-addons'), |
| 1891 |
'type' => Controls_Manager::NUMBER, |
| 1892 |
'min' => 0, |
| 1893 |
'step' => 1, |
| 1894 |
'default' => 8, |
| 1895 |
'selectors' => [ |
| 1896 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-pagination' => '--swiper-pagination-bullet-size: {{SIZE}}px;' |
| 1897 |
], |
| 1898 |
] |
| 1899 |
); |
| 1900 |
|
| 1901 |
$this->add_responsive_control( |
| 1902 |
'king_addons_testimonial_carousel_sw_pag_bullets_gap', |
| 1903 |
[ |
| 1904 |
'label' => esc_html__('Bullets gap', 'king-addons'), |
| 1905 |
'type' => Controls_Manager::NUMBER, |
| 1906 |
'min' => 0, |
| 1907 |
'step' => 1, |
| 1908 |
'default' => 4, |
| 1909 |
'selectors' => [ |
| 1910 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-pagination' => '--swiper-pagination-bullet-horizontal-gap: {{SIZE}}px;' |
| 1911 |
], |
| 1912 |
] |
| 1913 |
); |
| 1914 |
|
| 1915 |
$this->add_control( |
| 1916 |
'king_addons_testimonial_carousel_sw_pag_progressbar_title', |
| 1917 |
[ |
| 1918 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Progress bar type', 'king-addons'), |
| 1919 |
'type' => Controls_Manager::HEADING, |
| 1920 |
'separator' => 'before', |
| 1921 |
] |
| 1922 |
); |
| 1923 |
|
| 1924 |
$this->add_responsive_control( |
| 1925 |
'king_addons_testimonial_carousel_sw_pag_progressbar_size', |
| 1926 |
[ |
| 1927 |
'label' => esc_html__('Size', 'king-addons'), |
| 1928 |
'type' => Controls_Manager::NUMBER, |
| 1929 |
'min' => 0, |
| 1930 |
'step' => 1, |
| 1931 |
'default' => 4, |
| 1932 |
'selectors' => [ |
| 1933 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-pagination' => '--swiper-pagination-progressbar-size: {{SIZE}}px;' |
| 1934 |
], |
| 1935 |
] |
| 1936 |
); |
| 1937 |
|
| 1938 |
$this->add_control( |
| 1939 |
'king_addons_testimonial_carousel_sw_pag_fraction_title', |
| 1940 |
[ |
| 1941 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Fraction type', 'king-addons'), |
| 1942 |
'type' => Controls_Manager::HEADING, |
| 1943 |
'separator' => 'before', |
| 1944 |
] |
| 1945 |
); |
| 1946 |
|
| 1947 |
$this->add_group_control( |
| 1948 |
Group_Control_Typography::get_type(), |
| 1949 |
[ |
| 1950 |
'name' => 'king_addons_testimonial_carousel_sw_pag_fraction_typography', |
| 1951 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-sw-pagination.swiper-pagination-fraction', |
| 1952 |
] |
| 1953 |
); |
| 1954 |
|
| 1955 |
$this->end_controls_section(); |
| 1956 |
/** END SECTION: Pagination */ |
| 1957 |
|
| 1958 |
/** SECTION: Whole Carousel */ |
| 1959 |
$this->start_controls_section( |
| 1960 |
'king_addons_testimonial_carousel_sw_style_section_whole_carousel', |
| 1961 |
[ |
| 1962 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Whole Carousel', 'king-addons'), |
| 1963 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1964 |
] |
| 1965 |
); |
| 1966 |
|
| 1967 |
$this->add_group_control( |
| 1968 |
Group_Control_Background::get_type(), |
| 1969 |
[ |
| 1970 |
'name' => 'king_addons_testimonial_carousel_sw_whole_carousel_bg', |
| 1971 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-sw-items' |
| 1972 |
] |
| 1973 |
); |
| 1974 |
|
| 1975 |
$this->add_responsive_control( |
| 1976 |
'king_addons_testimonial_carousel_sw_whole_carousel_margin', |
| 1977 |
[ |
| 1978 |
'label' => esc_html__('Whole carousel margin', 'king-addons'), |
| 1979 |
'type' => Controls_Manager::DIMENSIONS, |
| 1980 |
'size_units' => ['px', '%'], |
| 1981 |
'default' => [ |
| 1982 |
'top' => 0, |
| 1983 |
'right' => 42, |
| 1984 |
'bottom' => 0, |
| 1985 |
'left' => 42, |
| 1986 |
'unit' => 'px', |
| 1987 |
], |
| 1988 |
'tablet_default' => [ |
| 1989 |
'top' => 0, |
| 1990 |
'right' => 0, |
| 1991 |
'bottom' => 0, |
| 1992 |
'left' => 0, |
| 1993 |
'unit' => 'px', |
| 1994 |
], |
| 1995 |
'mobile_default' => [ |
| 1996 |
'top' => 0, |
| 1997 |
'right' => 0, |
| 1998 |
'bottom' => 0, |
| 1999 |
'left' => 0, |
| 2000 |
'unit' => 'px', |
| 2001 |
], |
| 2002 |
'selectors' => [ |
| 2003 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-items' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2004 |
] |
| 2005 |
] |
| 2006 |
); |
| 2007 |
|
| 2008 |
$this->add_responsive_control( |
| 2009 |
'king_addons_testimonial_carousel_sw_whole_carousel_margin_wrapper', |
| 2010 |
[ |
| 2011 |
'label' => esc_html__('Cards wrapper margin', 'king-addons'), |
| 2012 |
'type' => Controls_Manager::DIMENSIONS, |
| 2013 |
'size_units' => ['px', '%'], |
| 2014 |
'default' => [ |
| 2015 |
'top' => 0, |
| 2016 |
'right' => 0, |
| 2017 |
'bottom' => 0, |
| 2018 |
'left' => 0, |
| 2019 |
'unit' => 'px', |
| 2020 |
], |
| 2021 |
'tablet_default' => [ |
| 2022 |
'top' => 0, |
| 2023 |
'right' => 0, |
| 2024 |
'bottom' => 0, |
| 2025 |
'left' => 0, |
| 2026 |
'unit' => 'px', |
| 2027 |
], |
| 2028 |
'mobile_default' => [ |
| 2029 |
'top' => 0, |
| 2030 |
'right' => 0, |
| 2031 |
'bottom' => 0, |
| 2032 |
'left' => 0, |
| 2033 |
'unit' => 'px', |
| 2034 |
], |
| 2035 |
'selectors' => [ |
| 2036 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-items .swiper-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2037 |
] |
| 2038 |
] |
| 2039 |
); |
| 2040 |
|
| 2041 |
$this->add_responsive_control( |
| 2042 |
'king_addons_testimonial_carousel_sw_whole_carousel_padding', |
| 2043 |
[ |
| 2044 |
'label' => esc_html__('Padding', 'king-addons'), |
| 2045 |
'type' => Controls_Manager::DIMENSIONS, |
| 2046 |
'size_units' => ['px', '%'], |
| 2047 |
'default' => [ |
| 2048 |
'top' => 15, |
| 2049 |
'right' => 15, |
| 2050 |
'bottom' => 56, |
| 2051 |
'left' => 15, |
| 2052 |
'unit' => 'px', |
| 2053 |
], |
| 2054 |
'selectors' => [ |
| 2055 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-items' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2056 |
] |
| 2057 |
] |
| 2058 |
); |
| 2059 |
|
| 2060 |
$this->add_group_control( |
| 2061 |
Group_Control_Box_Shadow::get_type(), |
| 2062 |
[ |
| 2063 |
'name' => 'king_addons_testimonial_carousel_sw_whole_carousel_box_shadow', |
| 2064 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-sw-items', |
| 2065 |
] |
| 2066 |
); |
| 2067 |
|
| 2068 |
$this->add_group_control( |
| 2069 |
Group_Control_Border::get_type(), |
| 2070 |
[ |
| 2071 |
'name' => 'king_addons_testimonial_carousel_sw_whole_carousel_border', |
| 2072 |
'selector' => '{{WRAPPER}} .king-addons-testimonial-carousel-sw-items', |
| 2073 |
'fields_options' => [ |
| 2074 |
'border' => [ |
| 2075 |
'default' => 'none', |
| 2076 |
], |
| 2077 |
], |
| 2078 |
] |
| 2079 |
); |
| 2080 |
|
| 2081 |
$this->add_responsive_control( |
| 2082 |
'king_addons_testimonial_carousel_sw_whole_carousel_border_radius', |
| 2083 |
[ |
| 2084 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 2085 |
'type' => Controls_Manager::DIMENSIONS, |
| 2086 |
'size_units' => ['px', '%'], |
| 2087 |
'default' => [ |
| 2088 |
'top' => 0, |
| 2089 |
'right' => 0, |
| 2090 |
'bottom' => 0, |
| 2091 |
'left' => 0, |
| 2092 |
'unit' => 'px', |
| 2093 |
], |
| 2094 |
'selectors' => [ |
| 2095 |
'{{WRAPPER}} .king-addons-testimonial-carousel-sw-items' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2096 |
] |
| 2097 |
] |
| 2098 |
); |
| 2099 |
|
| 2100 |
$this->end_controls_section(); |
| 2101 |
/** END SECTION: Whole Carousel */ |
| 2102 |
} |
| 2103 |
|
| 2104 |
protected function render(): void |
| 2105 |
{ |
| 2106 |
$settings_all = $this->get_settings(); |
| 2107 |
$this_ID = $this->get_id(); |
| 2108 |
|
| 2109 |
// Define allowed tags and attributes |
| 2110 |
$allowed_tags = wp_kses_allowed_html('post'); |
| 2111 |
$allowed_tags['img']['srcset'] = true; |
| 2112 |
$allowed_tags['img']['sizes'] = true; |
| 2113 |
$allowed_tags['img']['decoding'] = true; |
| 2114 |
$allowed_tags['img']['loading'] = true; |
| 2115 |
|
| 2116 |
$layout = $settings_all['king_addons_testimonial_carousel_layout']; |
| 2117 |
|
| 2118 |
/** START: Cards Container ===================== */ |
| 2119 |
?> |
| 2120 |
<div class="king-addons-testimonial-carousel-sw-items-wrap"> |
| 2121 |
<div class="king-addons-testimonial-carousel-sw-items king-addons-testimonial-carousel-sw-items-<?php echo esc_attr($this_ID); ?> swiper-container swiper"> |
| 2122 |
<div class="swiper-wrapper<?php if ('yes' === $settings_all['king_addons_testimonial_carousel_sw_autoplay_like_ticker_switcher']) { |
| 2123 |
echo ' king-addons-testimonial-carousel-sw-autoplay-like-ticker'; |
| 2124 |
} ?>"> |
| 2125 |
<?php |
| 2126 |
|
| 2127 |
foreach ($settings_all['king_addons_testimonial_carousel_content_items'] as $settings) { |
| 2128 |
|
| 2129 |
$title = $settings['king_addons_testimonial_carousel_title']; |
| 2130 |
$subtitle = $settings['king_addons_testimonial_carousel_subtitle']; |
| 2131 |
$description = $settings['king_addons_testimonial_carousel_description']; |
| 2132 |
|
| 2133 |
echo '<div class="swiper-slide">'; |
| 2134 |
echo '<div class="king-addons-testimonial-carousel-layout king-addons-testimonial-carousel-' . esc_attr($layout) . '">'; |
| 2135 |
|
| 2136 |
if ($layout === 'layout-1') { |
| 2137 |
|
| 2138 |
$this->renderImage($settings_all, $settings, $allowed_tags); |
| 2139 |
|
| 2140 |
echo '<div class="king-addons-testimonial-carousel-content">'; |
| 2141 |
|
| 2142 |
$this->renderDescription($description); |
| 2143 |
|
| 2144 |
$this->renderStars($settings_all, $settings); |
| 2145 |
|
| 2146 |
$this->renderPerson($title, $subtitle); |
| 2147 |
|
| 2148 |
echo '</div>'; |
| 2149 |
} |
| 2150 |
|
| 2151 |
if ($layout === 'layout-2') { |
| 2152 |
|
| 2153 |
echo '<div class="king-addons-testimonial-carousel-content">'; |
| 2154 |
|
| 2155 |
$this->renderDescription($description); |
| 2156 |
|
| 2157 |
$this->renderPerson($title, $subtitle); |
| 2158 |
|
| 2159 |
$this->renderStars($settings_all, $settings); |
| 2160 |
|
| 2161 |
echo '</div>'; |
| 2162 |
|
| 2163 |
$this->renderImage($settings_all, $settings, $allowed_tags); |
| 2164 |
} |
| 2165 |
|
| 2166 |
if ($layout === 'layout-3') { |
| 2167 |
|
| 2168 |
$this->renderDescription($description); |
| 2169 |
|
| 2170 |
$this->renderImage($settings_all, $settings, $allowed_tags); |
| 2171 |
|
| 2172 |
$this->renderPerson($title, $subtitle); |
| 2173 |
|
| 2174 |
$this->renderStars($settings_all, $settings); |
| 2175 |
|
| 2176 |
} |
| 2177 |
|
| 2178 |
if ($layout === 'layout-4') { |
| 2179 |
|
| 2180 |
$this->renderImage($settings_all, $settings, $allowed_tags); |
| 2181 |
|
| 2182 |
echo '<div class="king-addons-testimonial-carousel-content">'; |
| 2183 |
|
| 2184 |
$this->renderDescription($description); |
| 2185 |
|
| 2186 |
$this->renderStars($settings_all, $settings); |
| 2187 |
|
| 2188 |
$this->renderPerson($title, $subtitle); |
| 2189 |
|
| 2190 |
echo '</div>'; |
| 2191 |
} |
| 2192 |
|
| 2193 |
if ($layout === 'layout-5') { |
| 2194 |
|
| 2195 |
echo '<div class="king-addons-testimonial-carousel-content">'; |
| 2196 |
|
| 2197 |
$this->renderDescription($description); |
| 2198 |
|
| 2199 |
$this->renderStars($settings_all, $settings); |
| 2200 |
|
| 2201 |
$this->renderPerson($title, $subtitle); |
| 2202 |
|
| 2203 |
echo '</div>'; |
| 2204 |
|
| 2205 |
$this->renderImage($settings_all, $settings, $allowed_tags); |
| 2206 |
} |
| 2207 |
|
| 2208 |
if ($layout === 'layout-6') { |
| 2209 |
|
| 2210 |
$this->renderDescription($description); |
| 2211 |
|
| 2212 |
echo '<div class="king-addons-testimonial-carousel-content">'; |
| 2213 |
|
| 2214 |
$this->renderImage($settings_all, $settings, $allowed_tags); |
| 2215 |
|
| 2216 |
echo '<div class="king-addons-testimonial-carousel-content-inner">'; |
| 2217 |
|
| 2218 |
$this->renderPerson($title, $subtitle); |
| 2219 |
|
| 2220 |
$this->renderStars($settings_all, $settings); |
| 2221 |
|
| 2222 |
echo '</div>'; |
| 2223 |
|
| 2224 |
echo '</div>'; |
| 2225 |
} |
| 2226 |
|
| 2227 |
if ($layout === 'layout-7') { |
| 2228 |
|
| 2229 |
echo '<div class="king-addons-testimonial-carousel-content">'; |
| 2230 |
|
| 2231 |
$this->renderImage($settings_all, $settings, $allowed_tags); |
| 2232 |
|
| 2233 |
echo '<div class="king-addons-testimonial-carousel-content-inner">'; |
| 2234 |
|
| 2235 |
$this->renderPerson($title, $subtitle); |
| 2236 |
|
| 2237 |
$this->renderStars($settings_all, $settings); |
| 2238 |
|
| 2239 |
echo '</div>'; |
| 2240 |
|
| 2241 |
echo '</div>'; |
| 2242 |
|
| 2243 |
$this->renderDescription($description); |
| 2244 |
} |
| 2245 |
|
| 2246 |
if ($layout === 'layout-8') { |
| 2247 |
|
| 2248 |
$this->renderImage($settings_all, $settings, $allowed_tags); |
| 2249 |
|
| 2250 |
echo '<div class="king-addons-testimonial-carousel-content">'; |
| 2251 |
|
| 2252 |
$this->renderDescription($description); |
| 2253 |
|
| 2254 |
$this->renderStars($settings_all, $settings); |
| 2255 |
|
| 2256 |
$this->renderPerson($title, $subtitle); |
| 2257 |
|
| 2258 |
echo '</div>'; |
| 2259 |
} |
| 2260 |
|
| 2261 |
echo '</div>'; |
| 2262 |
echo '</div>'; |
| 2263 |
// END: foreach |
| 2264 |
} ?> |
| 2265 |
</div> |
| 2266 |
</div> |
| 2267 |
<?php |
| 2268 |
|
| 2269 |
// pagination |
| 2270 |
if ('yes' === $settings_all['king_addons_testimonial_carousel_sw_pag_switcher']) { |
| 2271 |
echo '<div class="swiper-pagination king-addons-testimonial-carousel-sw-pagination king-addons-testimonial-carousel-sw-pagination-' . |
| 2272 |
esc_attr($this_ID) . |
| 2273 |
(('yes' === $settings_all['king_addons_testimonial_carousel_sw_autoplay_like_ticker_switcher']) ? ' king-addons-testimonial-carousel-sw-autoplay-like-ticker-pag' : '') . |
| 2274 |
'"></div>'; |
| 2275 |
} |
| 2276 |
|
| 2277 |
// navigation |
| 2278 |
if ('yes' === $settings_all['king_addons_testimonial_carousel_sw_nav_switcher']) { |
| 2279 |
|
| 2280 |
echo '<div class="king-addons-testimonial-carousel-sw-nav-prev king-addons-testimonial-carousel-sw-nav-prev-' . esc_attr($this_ID) . ' king-addons-testimonial-carousel-sw-nav">'; |
| 2281 |
echo '<div class="king-addons-testimonial-carousel-sw-nav-inner">'; |
| 2282 |
Icons_Manager::render_icon($settings_all['king_addons_testimonial_carousel_sw_nav_icon_prev']); |
| 2283 |
echo '</div>'; |
| 2284 |
echo '</div>'; |
| 2285 |
|
| 2286 |
echo '<div class="king-addons-testimonial-carousel-sw-nav-next king-addons-testimonial-carousel-sw-nav-next-' . esc_attr($this_ID) . ' king-addons-testimonial-carousel-sw-nav">'; |
| 2287 |
echo '<div class="king-addons-testimonial-carousel-sw-nav-inner">'; |
| 2288 |
Icons_Manager::render_icon($settings_all['king_addons_testimonial_carousel_sw_nav_icon_next']); |
| 2289 |
echo '</div>'; |
| 2290 |
echo '</div>'; |
| 2291 |
|
| 2292 |
} |
| 2293 |
?> |
| 2294 |
</div> |
| 2295 |
<?php |
| 2296 |
|
| 2297 |
$js_swiper_check_if_DOM_already_loaded = "document.readyState === 'complete'"; |
| 2298 |
$js_swiper_check_if_DOM_not_already_loaded = "window.addEventListener('load', function () {"; |
| 2299 |
|
| 2300 |
$js_swiper = "new Swiper('.king-addons-testimonial-carousel-sw-items-" . esc_js($this_ID) . "', {"; |
| 2301 |
$js_swiper .= "direction: 'horizontal',"; |
| 2302 |
|
| 2303 |
$js_swiper .= "slidesPerView: " . esc_js($settings_all['king_addons_testimonial_carousel_sw_desktop_cards_per_view']) . ","; |
| 2304 |
$js_swiper .= "spaceBetween: " . esc_js($settings_all['king_addons_testimonial_carousel_sw_desktop_space_between_cards']) . ","; |
| 2305 |
|
| 2306 |
// Responsive breakpoints |
| 2307 |
$js_swiper .= 'breakpoints: {0: {slidesPerView: ' . |
| 2308 |
esc_js($settings_all['king_addons_testimonial_carousel_sw_mobile_cards_per_view']) . ', spaceBetween: ' . |
| 2309 |
esc_js($settings_all['king_addons_testimonial_carousel_sw_mobile_space_between_cards']) . '}, '; |
| 2310 |
$js_swiper .= |
| 2311 |
esc_js(($settings_all['king_addons_testimonial_carousel_sw_mobile_breakpoint'] + 1)) . ': {slidesPerView: ' . |
| 2312 |
esc_js($settings_all['king_addons_testimonial_carousel_sw_tablet_cards_per_view']) . ', spaceBetween: ' . |
| 2313 |
esc_js($settings_all['king_addons_testimonial_carousel_sw_tablet_space_between_cards']) . '}, '; |
| 2314 |
$js_swiper .= |
| 2315 |
esc_js(($settings_all['king_addons_testimonial_carousel_sw_tablet_breakpoint'] + 1)) . ': {slidesPerView: ' . |
| 2316 |
esc_js($settings_all['king_addons_testimonial_carousel_sw_desktop_cards_per_view']) . ', spaceBetween: ' . |
| 2317 |
esc_js($settings_all['king_addons_testimonial_carousel_sw_desktop_space_between_cards']) . '}},'; |
| 2318 |
|
| 2319 |
// Scrolling speed |
| 2320 |
if ('yes' !== $settings_all['king_addons_testimonial_carousel_sw_autoplay_like_ticker_switcher']) { |
| 2321 |
$js_swiper .= "speed: " . esc_js($settings_all['king_addons_testimonial_carousel_sw_scrolling_speed']) . ","; |
| 2322 |
} else { |
| 2323 |
$js_swiper .= "speed: " . esc_js($settings_all['king_addons_testimonial_carousel_sw_autoplay_like_ticker_autoplay_speed']) . ","; |
| 2324 |
} |
| 2325 |
|
| 2326 |
// Pagination |
| 2327 |
if ('yes' === $settings_all['king_addons_testimonial_carousel_sw_pag_switcher']) { |
| 2328 |
$js_swiper .= "pagination: {el: '.king-addons-testimonial-carousel-sw-pagination-" . |
| 2329 |
esc_js($this_ID) . "', " . |
| 2330 |
('yes' === $settings_all['king_addons_testimonial_carousel_sw_pag_clickable_switcher'] ? 'clickable: true, ' : ''); |
| 2331 |
if ('yes' === $settings_all['king_addons_testimonial_carousel_sw_pag_dynamic_switcher']) { |
| 2332 |
$js_swiper .= 'dynamicBullets: true, '; |
| 2333 |
$js_swiper .= 'dynamicMainBullets: ' . esc_js($settings_all['king_addons_testimonial_carousel_sw_pag_dynamic_number'] . ', '); |
| 2334 |
} |
| 2335 |
$js_swiper .= "type: '" . esc_js($settings_all['king_addons_testimonial_carousel_sw_pag_type']) . "'},"; |
| 2336 |
} |
| 2337 |
|
| 2338 |
// Navigation |
| 2339 |
if ('yes' === $settings_all['king_addons_testimonial_carousel_sw_nav_switcher']) { |
| 2340 |
$js_swiper .= "navigation: {nextEl: '.king-addons-testimonial-carousel-sw-nav-next-" . |
| 2341 |
esc_js($this_ID) . "', prevEl: '.king-addons-testimonial-carousel-sw-nav-prev-" . |
| 2342 |
esc_js($this_ID) . "'},"; |
| 2343 |
} |
| 2344 |
|
| 2345 |
// Loop |
| 2346 |
if ('yes' === $settings_all['king_addons_testimonial_carousel_sw_loop_switcher']) { |
| 2347 |
$js_swiper .= "loop: true,"; |
| 2348 |
} |
| 2349 |
|
| 2350 |
// Rewind |
| 2351 |
if ('yes' === $settings_all['king_addons_testimonial_carousel_sw_rewind_switcher']) { |
| 2352 |
$js_swiper .= "rewind: true,"; |
| 2353 |
} |
| 2354 |
|
| 2355 |
// Autoplay |
| 2356 |
if ('yes' === $settings_all['king_addons_testimonial_carousel_sw_autoplay_switcher']) { |
| 2357 |
$js_swiper .= "autoplay: {"; |
| 2358 |
if ('yes' !== $settings_all['king_addons_testimonial_carousel_sw_autoplay_like_ticker_switcher']) { |
| 2359 |
$js_swiper .= "delay: " . esc_js($settings_all['king_addons_testimonial_carousel_sw_autoplay_delay']) . ","; |
| 2360 |
} else { |
| 2361 |
$js_swiper .= "delay: 0,"; |
| 2362 |
} |
| 2363 |
$js_swiper .= "disableOnInteraction: " . ('yes' === $settings_all['king_addons_testimonial_carousel_sw_autoplay_disableoninteraction_switcher'] ? 'true' : 'false') . ","; |
| 2364 |
$js_swiper .= "pauseOnMouseEnter: " . ('yes' === $settings_all['king_addons_testimonial_carousel_sw_autoplay_pausedonmouseenter_switcher'] ? 'true' : 'false') . ","; |
| 2365 |
$js_swiper .= "reverseDirection: " . ('yes' === $settings_all['king_addons_testimonial_carousel_sw_autoplay_reversedirection_switcher'] ? 'true' : 'false') . ","; |
| 2366 |
$js_swiper .= "},"; |
| 2367 |
} |
| 2368 |
|
| 2369 |
$js_swiper .= "})"; |
| 2370 |
|
| 2371 |
$js_swiper_full = $js_swiper_check_if_DOM_already_loaded . ' ?' . $js_swiper . ' : ' . $js_swiper_check_if_DOM_not_already_loaded . $js_swiper . '; });'; |
| 2372 |
|
| 2373 |
wp_print_inline_script_tag($js_swiper_full); |
| 2374 |
/** END: Cards Container ===================== */ |
| 2375 |
|
| 2376 |
|
| 2377 |
} |
| 2378 |
|
| 2379 |
public function renderImage($settings_all, $settings, $allowed_tags): void |
| 2380 |
{ |
| 2381 |
if ($settings_all['king_addons_testimonial_carousel_image_switcher'] == 'yes') { |
| 2382 |
$image = Group_Control_Image_Size::get_attachment_image_html($settings, 'king_addons_testimonial_carousel_image_size', 'king_addons_testimonial_carousel_image'); |
| 2383 |
echo '<div class="king-addons-testimonial-carousel-image">'; |
| 2384 |
echo wp_kses($image, $allowed_tags); |
| 2385 |
echo '</div>'; |
| 2386 |
} |
| 2387 |
} |
| 2388 |
|
| 2389 |
public function renderPerson($title, $subtitle): void |
| 2390 |
{ |
| 2391 |
echo '<div class="king-addons-testimonial-carousel-person-wrapper">'; |
| 2392 |
|
| 2393 |
echo '<div class="king-addons-testimonial-carousel-title">'; |
| 2394 |
echo esc_html($title); |
| 2395 |
echo '</div>'; |
| 2396 |
|
| 2397 |
echo '<div class="king-addons-testimonial-carousel-subtitle">'; |
| 2398 |
echo esc_html($subtitle); |
| 2399 |
echo '</div>'; |
| 2400 |
|
| 2401 |
echo '</div>'; |
| 2402 |
} |
| 2403 |
|
| 2404 |
public function renderDescription($description): void |
| 2405 |
{ |
| 2406 |
echo '<div class="king-addons-testimonial-carousel-description">'; |
| 2407 |
echo wp_kses_post($description); |
| 2408 |
echo '</div>'; |
| 2409 |
} |
| 2410 |
|
| 2411 |
public function renderStars($settings_all, $settings): void |
| 2412 |
{ |
| 2413 |
if ($settings_all['king_addons_testimonial_carousel_rating_switcher'] == 'yes') { |
| 2414 |
echo '<div class="king-addons-testimonial-carousel-stars">'; |
| 2415 |
echo '<div class="king-addons-testimonial-carousel-rating-general">'; |
| 2416 |
$this->renderRating($settings_all, $settings); |
| 2417 |
echo '</div>'; |
| 2418 |
echo '</div>'; |
| 2419 |
} |
| 2420 |
} |
| 2421 |
|
| 2422 |
protected function get_rating_value($settings_all, $settings): float |
| 2423 |
{ |
| 2424 |
$initial_value = $this->get_rating_scale($settings_all); |
| 2425 |
$rating_value = $settings['king_addons_testimonial_carousel_rating_value']; |
| 2426 |
|
| 2427 |
if ('' === $rating_value) { |
| 2428 |
$rating_value = $initial_value; |
| 2429 |
} |
| 2430 |
|
| 2431 |
$rating_value = floatval($rating_value); |
| 2432 |
|
| 2433 |
return round($rating_value, 2); |
| 2434 |
} |
| 2435 |
|
| 2436 |
protected function get_rating_scale($settings_all): int |
| 2437 |
{ |
| 2438 |
return intval($settings_all['king_addons_testimonial_carousel_rating_scale']['size']); |
| 2439 |
} |
| 2440 |
|
| 2441 |
protected function get_icon_marked_width($settings_all, $settings, $icon_index): string |
| 2442 |
{ |
| 2443 |
$rating_value = $this->get_rating_value($settings_all, $settings); |
| 2444 |
|
| 2445 |
$width = '0%'; |
| 2446 |
|
| 2447 |
if ($rating_value >= $icon_index) { |
| 2448 |
$width = '100%'; |
| 2449 |
} elseif (intval(ceil($rating_value)) === $icon_index) { |
| 2450 |
$width = ($rating_value - ($icon_index - 1)) * 100 . '%'; |
| 2451 |
} |
| 2452 |
|
| 2453 |
return $width; |
| 2454 |
} |
| 2455 |
|
| 2456 |
protected function get_icon_markup($settings_all, $settings): string |
| 2457 |
{ |
| 2458 |
$icon = $settings_all['king_addons_testimonial_carousel_rating_icon']; |
| 2459 |
$rating_scale = $this->get_rating_scale($settings_all); |
| 2460 |
|
| 2461 |
ob_start(); |
| 2462 |
|
| 2463 |
for ($index = 1; $index <= $rating_scale; $index++) { |
| 2464 |
echo '<div class="king-addons-testimonial-carousel-icon">'; |
| 2465 |
|
| 2466 |
$icon_marked_width = $this->get_icon_marked_width($settings_all, $settings, $index); |
| 2467 |
|
| 2468 |
$style_attribute = $icon_marked_width !== '100%' ? 'style="--king-addons-testimonial-carousel-rating-icon-marked-width: ' . esc_attr($icon_marked_width) . ';"' : ''; |
| 2469 |
|
| 2470 |
echo '<div class="king-addons-testimonial-carousel-icon-wrapper king-addons-testimonial-carousel-icon-marked" ' . $style_attribute . '>'; |
| 2471 |
echo Icons_Manager::try_get_icon_html($icon, ['aria-hidden' => 'true']); |
| 2472 |
echo '</div>'; |
| 2473 |
|
| 2474 |
echo '<div class="king-addons-testimonial-carousel-icon-wrapper king-addons-testimonial-carousel-icon-unmarked">'; |
| 2475 |
echo Icons_Manager::try_get_icon_html($icon, ['aria-hidden' => 'true']); |
| 2476 |
echo '</div>'; |
| 2477 |
|
| 2478 |
echo '</div>'; |
| 2479 |
} |
| 2480 |
|
| 2481 |
return ob_get_clean(); |
| 2482 |
} |
| 2483 |
|
| 2484 |
protected function renderRating($settings_all, $settings): void |
| 2485 |
{ |
| 2486 |
$rating_value = $this->get_rating_value($settings_all, $settings); |
| 2487 |
$rating_scale = $this->get_rating_scale($settings_all); |
| 2488 |
$aria_label = sprintf( |
| 2489 |
esc_html__('Rated %1$s out of %2$s', 'king-addons'), |
| 2490 |
$rating_value, |
| 2491 |
$rating_scale |
| 2492 |
); |
| 2493 |
|
| 2494 |
echo '<div class="king-addons-testimonial-carousel-rating" itemtype="https://schema.org/Rating" itemscope itemprop="reviewRating">'; |
| 2495 |
?> |
| 2496 |
<meta itemprop="worstRating" content="0"> |
| 2497 |
<meta itemprop="bestRating" |
| 2498 |
content="<?php echo esc_attr($rating_scale); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 2499 |
?>"> |
| 2500 |
<div class="king-addons-testimonial-carousel-rating-wrapper" itemprop="ratingValue" |
| 2501 |
content="<?php echo esc_attr($rating_value); ?>" role="img" |
| 2502 |
aria-label="<?php echo esc_attr($aria_label); ?>"> |
| 2503 |
<?php echo $this->get_icon_markup($settings_all, $settings); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 2504 |
?> |
| 2505 |
</div> |
| 2506 |
<?php |
| 2507 |
echo '</div>'; |
| 2508 |
} |
| 2509 |
} |