| 1 |
<?php |
| 2 |
|
| 3 |
namespace King_Addons; |
| 4 |
|
| 5 |
use Elementor\Controls_Manager; |
| 6 |
use Elementor\Widget_Base; |
| 7 |
use Elementor\Group_Control_Typography; |
| 8 |
use Elementor\Group_Control_Background; |
| 9 |
use Elementor\Group_Control_Box_Shadow; |
| 10 |
use Elementor\Repeater; |
| 11 |
|
| 12 |
if (!defined('ABSPATH')) { |
| 13 |
exit; // Exit if accessed directly. |
| 14 |
} |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
class Pricing_Slider extends Widget_Base |
| 19 |
{ |
| 20 |
|
| 21 |
|
| 22 |
public function get_name(): string |
| 23 |
{ |
| 24 |
return 'king-addons-pricing-slider'; |
| 25 |
} |
| 26 |
|
| 27 |
public function get_title(): string |
| 28 |
{ |
| 29 |
return esc_html__('Pricing Slider', 'king-addons'); |
| 30 |
} |
| 31 |
|
| 32 |
public function get_icon(): string |
| 33 |
{ |
| 34 |
return 'king-addons-icon king-addons-pricing-slider'; |
| 35 |
} |
| 36 |
|
| 37 |
public function get_style_depends(): array |
| 38 |
{ |
| 39 |
return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-pricing-slider-style']; |
| 40 |
} |
| 41 |
|
| 42 |
public function get_script_depends(): array |
| 43 |
{ |
| 44 |
return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-pricing-slider-script']; |
| 45 |
} |
| 46 |
|
| 47 |
public function get_categories(): array |
| 48 |
{ |
| 49 |
return ['king-addons']; |
| 50 |
} |
| 51 |
|
| 52 |
public function get_keywords(): array |
| 53 |
{ |
| 54 |
return [ |
| 55 |
'price', |
| 56 |
'pricing', |
| 57 |
'slider', |
| 58 |
'pricing slider', |
| 59 |
'features', |
| 60 |
'range slider', |
| 61 |
'slider pricing', |
| 62 |
'king addons', |
| 63 |
'king', |
| 64 |
'addons', |
| 65 |
'kingaddons', |
| 66 |
'king-addons' |
| 67 |
]; |
| 68 |
} |
| 69 |
|
| 70 |
public function get_custom_help_url() |
| 71 |
{ |
| 72 |
return 'mailto:bug@kingaddons.com?subject=Bug Report - King Addons&body=Please describe the issue'; |
| 73 |
} |
| 74 |
|
| 75 |
protected function register_controls() |
| 76 |
{ |
| 77 |
$this->start_controls_section( |
| 78 |
'section_pricing_slider', |
| 79 |
[ |
| 80 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Pricing Slider', 'king-addons'), |
| 81 |
] |
| 82 |
); |
| 83 |
|
| 84 |
if (!king_addons_freemius()->can_use_premium_code__premium_only()) { |
| 85 |
$this->add_control( |
| 86 |
'pricing_slider_pro_notice', |
| 87 |
[ |
| 88 |
'type' => Controls_Manager::RAW_HTML, |
| 89 |
'raw' => 'Advanced Formulas, Multiple Sliders, and WooCommerce Integration options are available in the <strong><a href="https://kingaddons.com/pricing/?utm_source=kng-module-pricing-slider-settings-upgrade-pro&utm_medium=plugin&utm_campaign=kng" target="_blank">Pro version</a></strong>', |
| 90 |
'content_classes' => 'king-addons-pro-notice', |
| 91 |
] |
| 92 |
); |
| 93 |
} |
| 94 |
|
| 95 |
$this->add_control( |
| 96 |
'title', |
| 97 |
[ |
| 98 |
'label' => esc_html__('Title', 'king-addons'), |
| 99 |
'type' => Controls_Manager::TEXT, |
| 100 |
'default' => esc_html__('Pricing Plans', 'king-addons'), |
| 101 |
'placeholder' => esc_html__('Enter title', 'king-addons'), |
| 102 |
'label_block' => true, |
| 103 |
] |
| 104 |
); |
| 105 |
|
| 106 |
$this->add_control( |
| 107 |
'description', |
| 108 |
[ |
| 109 |
'label' => esc_html__('Description', 'king-addons'), |
| 110 |
'type' => Controls_Manager::TEXTAREA, |
| 111 |
'default' => esc_html__('Choose the perfect plan for your needs', 'king-addons'), |
| 112 |
'placeholder' => esc_html__('Enter description', 'king-addons'), |
| 113 |
'rows' => 5, |
| 114 |
] |
| 115 |
); |
| 116 |
|
| 117 |
$this->end_controls_section(); |
| 118 |
|
| 119 |
$this->start_controls_section( |
| 120 |
'section_pricing_slider_settings', |
| 121 |
[ |
| 122 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Slider Settings', 'king-addons'), |
| 123 |
] |
| 124 |
); |
| 125 |
|
| 126 |
$this->add_control( |
| 127 |
'min_value', |
| 128 |
[ |
| 129 |
'label' => esc_html__('Minimum Value', 'king-addons'), |
| 130 |
'type' => Controls_Manager::NUMBER, |
| 131 |
'default' => 1, |
| 132 |
'min' => 0, |
| 133 |
'step' => 1, |
| 134 |
] |
| 135 |
); |
| 136 |
|
| 137 |
$this->add_control( |
| 138 |
'max_value', |
| 139 |
[ |
| 140 |
'label' => esc_html__('Maximum Value', 'king-addons'), |
| 141 |
'type' => Controls_Manager::NUMBER, |
| 142 |
'default' => 100, |
| 143 |
'min' => 1, |
| 144 |
'step' => 1, |
| 145 |
] |
| 146 |
); |
| 147 |
|
| 148 |
$this->add_control( |
| 149 |
'default_value', |
| 150 |
[ |
| 151 |
'label' => esc_html__('Default Value', 'king-addons'), |
| 152 |
'type' => Controls_Manager::NUMBER, |
| 153 |
'default' => 50, |
| 154 |
'min' => 1, |
| 155 |
'step' => 1, |
| 156 |
] |
| 157 |
); |
| 158 |
|
| 159 |
$this->add_control( |
| 160 |
'step', |
| 161 |
[ |
| 162 |
'label' => esc_html__('Step', 'king-addons'), |
| 163 |
'type' => Controls_Manager::NUMBER, |
| 164 |
'default' => 1, |
| 165 |
'min' => 1, |
| 166 |
'step' => 1, |
| 167 |
] |
| 168 |
); |
| 169 |
|
| 170 |
$this->add_control( |
| 171 |
'min_label', |
| 172 |
[ |
| 173 |
'label' => esc_html__('Minimum Label', 'king-addons'), |
| 174 |
'type' => Controls_Manager::TEXT, |
| 175 |
'default' => esc_html__('Basic', 'king-addons'), |
| 176 |
'placeholder' => esc_html__('Enter label', 'king-addons'), |
| 177 |
] |
| 178 |
); |
| 179 |
|
| 180 |
$this->add_control( |
| 181 |
'max_label', |
| 182 |
[ |
| 183 |
'label' => esc_html__('Maximum Label', 'king-addons'), |
| 184 |
'type' => Controls_Manager::TEXT, |
| 185 |
'default' => esc_html__('Premium', 'king-addons'), |
| 186 |
'placeholder' => esc_html__('Enter label', 'king-addons'), |
| 187 |
] |
| 188 |
); |
| 189 |
|
| 190 |
$this->add_control( |
| 191 |
'price_prefix', |
| 192 |
[ |
| 193 |
'label' => esc_html__('Price Prefix', 'king-addons'), |
| 194 |
'type' => Controls_Manager::TEXT, |
| 195 |
'default' => '', |
| 196 |
'placeholder' => esc_html__('Before price', 'king-addons'), |
| 197 |
] |
| 198 |
); |
| 199 |
|
| 200 |
$this->add_control( |
| 201 |
'price_suffix', |
| 202 |
[ |
| 203 |
'label' => esc_html__('Price Suffix', 'king-addons'), |
| 204 |
'type' => Controls_Manager::TEXT, |
| 205 |
'default' => '', |
| 206 |
'placeholder' => esc_html__('After price', 'king-addons'), |
| 207 |
] |
| 208 |
); |
| 209 |
|
| 210 |
$this->add_control( |
| 211 |
'currency_symbol', |
| 212 |
[ |
| 213 |
'label' => esc_html__('Currency Symbol', 'king-addons'), |
| 214 |
'type' => Controls_Manager::SELECT, |
| 215 |
'options' => [ |
| 216 |
'' => esc_html__('None', 'king-addons'), |
| 217 |
'dollar' => '$ ' . esc_html__('Dollar', 'king-addons'), |
| 218 |
'euro' => '€ ' . esc_html__('Euro', 'king-addons'), |
| 219 |
'pound' => '£ ' . esc_html__('Pound Sterling', 'king-addons'), |
| 220 |
'ruble' => '₽ ' . esc_html__('Ruble', 'king-addons'), |
| 221 |
'shekel' => '₪ ' . esc_html__('Shekel', 'king-addons'), |
| 222 |
'baht' => '฿ ' . esc_html__('Baht', 'king-addons'), |
| 223 |
'yen' => '¥ ' . esc_html__('Yen/Yuan', 'king-addons'), |
| 224 |
'won' => '₩ ' . esc_html__('Won', 'king-addons'), |
| 225 |
'rupee' => '₨ ' . esc_html__('Rupee', 'king-addons'), |
| 226 |
'lira' => '₤ ' . esc_html__('Lira', 'king-addons'), |
| 227 |
'peseta' => '₧ ' . esc_html__('Peseta', 'king-addons'), |
| 228 |
'custom' => esc_html__('Custom', 'king-addons'), |
| 229 |
], |
| 230 |
'default' => 'dollar', |
| 231 |
] |
| 232 |
); |
| 233 |
|
| 234 |
$this->add_control( |
| 235 |
'currency_symbol_custom', |
| 236 |
[ |
| 237 |
'label' => esc_html__('Custom Symbol', 'king-addons'), |
| 238 |
'type' => Controls_Manager::TEXT, |
| 239 |
'condition' => [ |
| 240 |
'currency_symbol' => 'custom', |
| 241 |
], |
| 242 |
] |
| 243 |
); |
| 244 |
|
| 245 |
$this->add_control( |
| 246 |
'currency_position', |
| 247 |
[ |
| 248 |
'label' => esc_html__('Currency Position', 'king-addons'), |
| 249 |
'type' => Controls_Manager::SELECT, |
| 250 |
'default' => 'before', |
| 251 |
'options' => [ |
| 252 |
'before' => esc_html__('Before', 'king-addons'), |
| 253 |
'after' => esc_html__('After', 'king-addons'), |
| 254 |
], |
| 255 |
] |
| 256 |
); |
| 257 |
|
| 258 |
$this->add_control( |
| 259 |
'period', |
| 260 |
[ |
| 261 |
'label' => esc_html__('Period', 'king-addons'), |
| 262 |
'type' => Controls_Manager::TEXT, |
| 263 |
'default' => esc_html__('/month', 'king-addons'), |
| 264 |
'placeholder' => esc_html__('e.g. /month', 'king-addons'), |
| 265 |
] |
| 266 |
); |
| 267 |
|
| 268 |
$this->add_control( |
| 269 |
'price_formula', |
| 270 |
[ |
| 271 |
'label' => esc_html__('Price Formula', 'king-addons'), |
| 272 |
'type' => Controls_Manager::SELECT, |
| 273 |
'default' => 'linear', |
| 274 |
'options' => [ |
| 275 |
'linear' => esc_html__('Linear (ax + b)', 'king-addons'), |
| 276 |
'custom' => esc_html__('Custom Prices', 'king-addons'), |
| 277 |
], |
| 278 |
'condition' => [ |
| 279 |
'advanced_formula_types' => 'linear', |
| 280 |
], |
| 281 |
] |
| 282 |
); |
| 283 |
|
| 284 |
$this->add_control( |
| 285 |
'formula_a', |
| 286 |
[ |
| 287 |
'label' => esc_html__('Coefficient (a)', 'king-addons'), |
| 288 |
'type' => Controls_Manager::NUMBER, |
| 289 |
'default' => 1, |
| 290 |
'step' => 0.1, |
| 291 |
'condition' => [ |
| 292 |
'price_formula' => 'linear', |
| 293 |
], |
| 294 |
] |
| 295 |
); |
| 296 |
|
| 297 |
$this->add_control( |
| 298 |
'formula_b', |
| 299 |
[ |
| 300 |
'label' => esc_html__('Constant (b)', 'king-addons'), |
| 301 |
'type' => Controls_Manager::NUMBER, |
| 302 |
'default' => 0, |
| 303 |
'step' => 1, |
| 304 |
'condition' => [ |
| 305 |
'price_formula' => 'linear', |
| 306 |
], |
| 307 |
] |
| 308 |
); |
| 309 |
|
| 310 |
$repeater = new Repeater(); |
| 311 |
|
| 312 |
$repeater->add_control( |
| 313 |
'value', |
| 314 |
[ |
| 315 |
'label' => esc_html__('Value', 'king-addons'), |
| 316 |
'type' => Controls_Manager::NUMBER, |
| 317 |
'default' => 1, |
| 318 |
'min' => 0, |
| 319 |
'step' => 1, |
| 320 |
] |
| 321 |
); |
| 322 |
|
| 323 |
$repeater->add_control( |
| 324 |
'price', |
| 325 |
[ |
| 326 |
'label' => esc_html__('Price', 'king-addons'), |
| 327 |
'type' => Controls_Manager::NUMBER, |
| 328 |
'default' => 10, |
| 329 |
'min' => 0, |
| 330 |
'step' => 0.01, |
| 331 |
] |
| 332 |
); |
| 333 |
|
| 334 |
$this->add_control( |
| 335 |
'custom_prices', |
| 336 |
[ |
| 337 |
'label' => esc_html__('Custom Prices', 'king-addons'), |
| 338 |
'type' => Controls_Manager::REPEATER, |
| 339 |
'fields' => $repeater->get_controls(), |
| 340 |
'default' => [ |
| 341 |
[ |
| 342 |
'value' => 1, |
| 343 |
'price' => 9.99, |
| 344 |
], |
| 345 |
[ |
| 346 |
'value' => 50, |
| 347 |
'price' => 49.99, |
| 348 |
], |
| 349 |
[ |
| 350 |
'value' => 100, |
| 351 |
'price' => 99.99, |
| 352 |
], |
| 353 |
], |
| 354 |
'title_field' => '{{ value }} - {{ price }}', |
| 355 |
'condition' => [ |
| 356 |
'price_formula' => 'custom', |
| 357 |
], |
| 358 |
] |
| 359 |
); |
| 360 |
|
| 361 |
$this->end_controls_section(); |
| 362 |
|
| 363 |
// Features Section |
| 364 |
$this->start_controls_section( |
| 365 |
'section_features', |
| 366 |
[ |
| 367 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Features', 'king-addons'), |
| 368 |
] |
| 369 |
); |
| 370 |
|
| 371 |
$this->add_control( |
| 372 |
'show_features', |
| 373 |
[ |
| 374 |
'label' => esc_html__('Show Features', 'king-addons'), |
| 375 |
'type' => Controls_Manager::SWITCHER, |
| 376 |
'default' => 'yes', |
| 377 |
'label_on' => esc_html__('Show', 'king-addons'), |
| 378 |
'label_off' => esc_html__('Hide', 'king-addons'), |
| 379 |
] |
| 380 |
); |
| 381 |
|
| 382 |
$feature_repeater = new Repeater(); |
| 383 |
|
| 384 |
$feature_repeater->add_control( |
| 385 |
'feature_text', |
| 386 |
[ |
| 387 |
'label' => esc_html__('Feature Text', 'king-addons'), |
| 388 |
'type' => Controls_Manager::TEXT, |
| 389 |
'default' => esc_html__('Feature Item', 'king-addons'), |
| 390 |
'label_block' => true, |
| 391 |
] |
| 392 |
); |
| 393 |
|
| 394 |
$feature_repeater->add_control( |
| 395 |
'min_value_feature', |
| 396 |
[ |
| 397 |
'label' => esc_html__('Minimum Value', 'king-addons'), |
| 398 |
'type' => Controls_Manager::NUMBER, |
| 399 |
'default' => 1, |
| 400 |
'min' => 0, |
| 401 |
'step' => 1, |
| 402 |
'description' => esc_html__('Feature will be included starting from this value', 'king-addons'), |
| 403 |
] |
| 404 |
); |
| 405 |
|
| 406 |
$feature_repeater->add_control( |
| 407 |
'feature_icon_included', |
| 408 |
[ |
| 409 |
'label' => esc_html__('Included Icon', 'king-addons'), |
| 410 |
'type' => Controls_Manager::ICONS, |
| 411 |
'default' => [ |
| 412 |
'value' => 'fas fa-check', |
| 413 |
'library' => 'fa-solid', |
| 414 |
], |
| 415 |
] |
| 416 |
); |
| 417 |
|
| 418 |
$feature_repeater->add_control( |
| 419 |
'feature_icon_excluded', |
| 420 |
[ |
| 421 |
'label' => esc_html__('Excluded Icon', 'king-addons'), |
| 422 |
'type' => Controls_Manager::ICONS, |
| 423 |
'default' => [ |
| 424 |
'value' => 'fas fa-times', |
| 425 |
'library' => 'fa-solid', |
| 426 |
], |
| 427 |
] |
| 428 |
); |
| 429 |
|
| 430 |
$this->add_control( |
| 431 |
'feature_list', |
| 432 |
[ |
| 433 |
'label' => esc_html__('Features', 'king-addons'), |
| 434 |
'type' => Controls_Manager::REPEATER, |
| 435 |
'fields' => $feature_repeater->get_controls(), |
| 436 |
'default' => [ |
| 437 |
[ |
| 438 |
'feature_text' => esc_html__('Basic Feature', 'king-addons'), |
| 439 |
'min_value_feature' => 1, |
| 440 |
], |
| 441 |
[ |
| 442 |
'feature_text' => esc_html__('Advanced Feature', 'king-addons'), |
| 443 |
'min_value_feature' => 30, |
| 444 |
], |
| 445 |
[ |
| 446 |
'feature_text' => esc_html__('Premium Feature', 'king-addons'), |
| 447 |
'min_value_feature' => 60, |
| 448 |
], |
| 449 |
], |
| 450 |
'title_field' => '{{ feature_text }}', |
| 451 |
'condition' => [ |
| 452 |
'show_features' => 'yes', |
| 453 |
], |
| 454 |
] |
| 455 |
); |
| 456 |
|
| 457 |
$this->end_controls_section(); |
| 458 |
|
| 459 |
// Button Section |
| 460 |
$this->start_controls_section( |
| 461 |
'section_button', |
| 462 |
[ |
| 463 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Button', 'king-addons'), |
| 464 |
] |
| 465 |
); |
| 466 |
|
| 467 |
$this->add_control( |
| 468 |
'show_button', |
| 469 |
[ |
| 470 |
'label' => esc_html__('Show Button', 'king-addons'), |
| 471 |
'type' => Controls_Manager::SWITCHER, |
| 472 |
'default' => 'yes', |
| 473 |
'label_on' => esc_html__('Show', 'king-addons'), |
| 474 |
'label_off' => esc_html__('Hide', 'king-addons'), |
| 475 |
] |
| 476 |
); |
| 477 |
|
| 478 |
$this->add_control( |
| 479 |
'button_text', |
| 480 |
[ |
| 481 |
'label' => esc_html__('Button Text', 'king-addons'), |
| 482 |
'type' => Controls_Manager::TEXT, |
| 483 |
'default' => esc_html__('Choose Plan', 'king-addons'), |
| 484 |
'placeholder' => esc_html__('Enter button text', 'king-addons'), |
| 485 |
'condition' => [ |
| 486 |
'show_button' => 'yes', |
| 487 |
], |
| 488 |
] |
| 489 |
); |
| 490 |
|
| 491 |
$this->add_control( |
| 492 |
'button_url', |
| 493 |
[ |
| 494 |
'label' => esc_html__('Button URL', 'king-addons'), |
| 495 |
'type' => Controls_Manager::URL, |
| 496 |
'placeholder' => esc_html__('https://your-link.com', 'king-addons'), |
| 497 |
'default' => [ |
| 498 |
'url' => '#', |
| 499 |
], |
| 500 |
'condition' => [ |
| 501 |
'show_button' => 'yes', |
| 502 |
], |
| 503 |
] |
| 504 |
); |
| 505 |
|
| 506 |
$this->end_controls_section(); |
| 507 |
|
| 508 |
// Style Tab |
| 509 |
$this->start_controls_section( |
| 510 |
'section_header_style', |
| 511 |
[ |
| 512 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Header', 'king-addons'), |
| 513 |
'tab' => Controls_Manager::TAB_STYLE, |
| 514 |
] |
| 515 |
); |
| 516 |
|
| 517 |
$this->add_control( |
| 518 |
'title_color', |
| 519 |
[ |
| 520 |
'label' => esc_html__('Title Color', 'king-addons'), |
| 521 |
'type' => Controls_Manager::COLOR, |
| 522 |
'default' => '#333333', // Updated default |
| 523 |
'selectors' => [ |
| 524 |
'{{WRAPPER}} .king-addons-pricing-slider__title' => 'color: {{VALUE}};', |
| 525 |
], |
| 526 |
] |
| 527 |
); |
| 528 |
|
| 529 |
$this->add_group_control( |
| 530 |
Group_Control_Typography::get_type(), |
| 531 |
[ |
| 532 |
'name' => 'title_typography', |
| 533 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__title', |
| 534 |
// Example: Set a default size if desired |
| 535 |
// 'fields_options' => [ |
| 536 |
// 'font_size' => ['default' => ['unit' => 'px', 'size' => 28]], |
| 537 |
// ], |
| 538 |
] |
| 539 |
); |
| 540 |
|
| 541 |
$this->add_control( |
| 542 |
'description_color', |
| 543 |
[ |
| 544 |
'label' => esc_html__('Description Color', 'king-addons'), |
| 545 |
'type' => Controls_Manager::COLOR, |
| 546 |
'default' => '#777777', // Updated default |
| 547 |
'selectors' => [ |
| 548 |
'{{WRAPPER}} .king-addons-pricing-slider__description' => 'color: {{VALUE}};', |
| 549 |
], |
| 550 |
'separator' => 'before', |
| 551 |
] |
| 552 |
); |
| 553 |
|
| 554 |
$this->add_group_control( |
| 555 |
Group_Control_Typography::get_type(), |
| 556 |
[ |
| 557 |
'name' => 'description_typography', |
| 558 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__description', |
| 559 |
// Example: Set a default size if desired |
| 560 |
// 'fields_options' => [ |
| 561 |
// 'font_size' => ['default' => ['unit' => 'px', 'size' => 16]], |
| 562 |
// ], |
| 563 |
] |
| 564 |
); |
| 565 |
|
| 566 |
$this->add_responsive_control( |
| 567 |
'header_spacing', |
| 568 |
[ |
| 569 |
'label' => esc_html__('Spacing', 'king-addons'), |
| 570 |
'type' => Controls_Manager::SLIDER, |
| 571 |
'size_units' => ['px', 'em', 'rem'], |
| 572 |
'range' => [ |
| 573 |
'px' => [ |
| 574 |
'min' => 0, |
| 575 |
'max' => 100, |
| 576 |
], |
| 577 |
], |
| 578 |
'default' => [ // Added default |
| 579 |
'unit' => 'px', |
| 580 |
'size' => 30, |
| 581 |
], |
| 582 |
'selectors' => [ |
| 583 |
'{{WRAPPER}} .king-addons-pricing-slider__header' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 584 |
], |
| 585 |
] |
| 586 |
); |
| 587 |
|
| 588 |
$this->add_control( |
| 589 |
'header_alignment', |
| 590 |
[ |
| 591 |
'label' => esc_html__('Alignment', 'king-addons'), |
| 592 |
'type' => Controls_Manager::CHOOSE, |
| 593 |
'options' => [ |
| 594 |
'left' => [ |
| 595 |
'title' => esc_html__('Left', 'king-addons'), |
| 596 |
'icon' => 'eicon-text-align-left', |
| 597 |
], |
| 598 |
'center' => [ |
| 599 |
'title' => esc_html__('Center', 'king-addons'), |
| 600 |
'icon' => 'eicon-text-align-center', |
| 601 |
], |
| 602 |
'right' => [ |
| 603 |
'title' => esc_html__('Right', 'king-addons'), |
| 604 |
'icon' => 'eicon-text-align-right', |
| 605 |
], |
| 606 |
], |
| 607 |
'default' => 'center', |
| 608 |
'selectors' => [ |
| 609 |
'{{WRAPPER}} .king-addons-pricing-slider__header' => 'text-align: {{VALUE}};', |
| 610 |
], |
| 611 |
] |
| 612 |
); |
| 613 |
|
| 614 |
$this->end_controls_section(); |
| 615 |
|
| 616 |
// Slider Style Section |
| 617 |
$this->start_controls_section( |
| 618 |
'section_slider_style', |
| 619 |
[ |
| 620 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Slider', 'king-addons'), |
| 621 |
'tab' => Controls_Manager::TAB_STYLE, |
| 622 |
] |
| 623 |
); |
| 624 |
|
| 625 |
// Track Styles |
| 626 |
$this->add_control( |
| 627 |
'slider_track_heading', |
| 628 |
[ |
| 629 |
'label' => esc_html__('Track (Line)', 'king-addons'), |
| 630 |
'type' => Controls_Manager::HEADING, |
| 631 |
] |
| 632 |
); |
| 633 |
|
| 634 |
$this->add_control( |
| 635 |
'slider_track_color', |
| 636 |
[ |
| 637 |
'label' => esc_html__('Track Background Color', 'king-addons'), |
| 638 |
'type' => Controls_Manager::COLOR, |
| 639 |
'default' => '#e0e0e0', // Updated default |
| 640 |
'selectors' => [ |
| 641 |
'{{WRAPPER}} .king-addons-pricing-slider__track' => 'background-color: {{VALUE}};', |
| 642 |
], |
| 643 |
] |
| 644 |
); |
| 645 |
|
| 646 |
$this->add_responsive_control( |
| 647 |
'slider_track_height', |
| 648 |
[ |
| 649 |
'label' => esc_html__('Track Height', 'king-addons'), |
| 650 |
'type' => Controls_Manager::SLIDER, |
| 651 |
'size_units' => ['px'], |
| 652 |
'range' => [ |
| 653 |
'px' => [ |
| 654 |
'min' => 1, |
| 655 |
'max' => 50, |
| 656 |
], |
| 657 |
], |
| 658 |
'default' => [ |
| 659 |
'unit' => 'px', |
| 660 |
'size' => 6, |
| 661 |
], |
| 662 |
'selectors' => [ |
| 663 |
'{{WRAPPER}}' => '--slider-track-height: {{SIZE}}{{UNIT}};', |
| 664 |
], |
| 665 |
'render_type' => 'template', |
| 666 |
] |
| 667 |
); |
| 668 |
|
| 669 |
// Progress Styles |
| 670 |
$this->add_control( |
| 671 |
'slider_progress_heading', |
| 672 |
[ |
| 673 |
'label' => esc_html__('Progress (Active Track)', 'king-addons'), |
| 674 |
'type' => Controls_Manager::HEADING, |
| 675 |
'separator' => 'before', |
| 676 |
] |
| 677 |
); |
| 678 |
|
| 679 |
$this->add_control( |
| 680 |
'slider_progress_color', |
| 681 |
[ |
| 682 |
'label' => esc_html__('Progress Color', 'king-addons'), |
| 683 |
'type' => Controls_Manager::COLOR, |
| 684 |
'default' => '#0073e6', // Updated default |
| 685 |
'selectors' => [ |
| 686 |
'{{WRAPPER}} .king-addons-pricing-slider__progress' => 'background-color: {{VALUE}};', |
| 687 |
], |
| 688 |
] |
| 689 |
); |
| 690 |
|
| 691 |
// Thumb Styles |
| 692 |
$this->add_control( |
| 693 |
'slider_thumb_heading', |
| 694 |
[ |
| 695 |
'label' => esc_html__('Thumb (Handle)', 'king-addons'), |
| 696 |
'type' => Controls_Manager::HEADING, |
| 697 |
'separator' => 'before', |
| 698 |
] |
| 699 |
); |
| 700 |
|
| 701 |
$this->add_control( |
| 702 |
'slider_thumb_color', |
| 703 |
[ |
| 704 |
'label' => esc_html__('Thumb Color', 'king-addons'), |
| 705 |
'type' => Controls_Manager::COLOR, |
| 706 |
'default' => '#0073e6', // Updated default |
| 707 |
'selectors' => [ |
| 708 |
'{{WRAPPER}} .king-addons-pricing-slider__custom-thumb' => 'background-color: {{VALUE}};', |
| 709 |
], |
| 710 |
] |
| 711 |
); |
| 712 |
|
| 713 |
$this->add_responsive_control( |
| 714 |
'slider_thumb_size', |
| 715 |
[ |
| 716 |
'label' => esc_html__('Thumb Size', 'king-addons'), |
| 717 |
'type' => Controls_Manager::SLIDER, |
| 718 |
'size_units' => ['px'], |
| 719 |
'range' => [ |
| 720 |
'px' => [ |
| 721 |
'min' => 10, |
| 722 |
'max' => 100, |
| 723 |
], |
| 724 |
], |
| 725 |
'default' => [ |
| 726 |
'unit' => 'px', |
| 727 |
'size' => 24, |
| 728 |
], |
| 729 |
'selectors' => [ |
| 730 |
'{{WRAPPER}}' => '--slider-thumb-size: {{SIZE}}{{UNIT}};', |
| 731 |
], |
| 732 |
'render_type' => 'template', |
| 733 |
] |
| 734 |
); |
| 735 |
|
| 736 |
$this->add_control( |
| 737 |
'slider_thumb_border_heading', |
| 738 |
[ |
| 739 |
'label' => esc_html__('Thumb Border', 'king-addons'), |
| 740 |
'type' => Controls_Manager::HEADING, |
| 741 |
'separator' => 'before', |
| 742 |
] |
| 743 |
); |
| 744 |
|
| 745 |
$this->add_control( |
| 746 |
'slider_thumb_border_color', |
| 747 |
[ |
| 748 |
'label' => esc_html__('Border Color', 'king-addons'), |
| 749 |
'type' => Controls_Manager::COLOR, |
| 750 |
'default' => '#ffffff', |
| 751 |
'selectors' => [ |
| 752 |
'{{WRAPPER}} .king-addons-pricing-slider__custom-thumb' => 'border-color: {{VALUE}};', |
| 753 |
], |
| 754 |
] |
| 755 |
); |
| 756 |
|
| 757 |
$this->add_control( |
| 758 |
'slider_thumb_border_width', |
| 759 |
[ |
| 760 |
'label' => esc_html__('Border Width', 'king-addons'), |
| 761 |
'type' => Controls_Manager::SLIDER, |
| 762 |
'size_units' => ['px'], |
| 763 |
'range' => [ |
| 764 |
'px' => [ |
| 765 |
'min' => 0, |
| 766 |
'max' => 20, |
| 767 |
], |
| 768 |
], |
| 769 |
'default' => [ |
| 770 |
'unit' => 'px', |
| 771 |
'size' => 2, |
| 772 |
], |
| 773 |
'selectors' => [ |
| 774 |
'{{WRAPPER}} .king-addons-pricing-slider__custom-thumb' => 'border-width: {{SIZE}}{{UNIT}};', |
| 775 |
], |
| 776 |
] |
| 777 |
); |
| 778 |
|
| 779 |
$this->add_control( |
| 780 |
'slider_thumb_border_style', |
| 781 |
[ |
| 782 |
'label' => esc_html__('Border Style', 'king-addons'), |
| 783 |
'type' => Controls_Manager::SELECT, |
| 784 |
'options' => [ |
| 785 |
'' => esc_html__('Default', 'king-addons'), |
| 786 |
'none' => esc_html__('None', 'king-addons'), |
| 787 |
'solid' => esc_html__('Solid', 'king-addons'), |
| 788 |
'dashed' => esc_html__('Dashed', 'king-addons'), |
| 789 |
'dotted' => esc_html__('Dotted', 'king-addons'), |
| 790 |
'double' => esc_html__('Double', 'king-addons'), |
| 791 |
], |
| 792 |
'default' => 'solid', |
| 793 |
'selectors' => [ |
| 794 |
'{{WRAPPER}} .king-addons-pricing-slider__custom-thumb' => 'border-style: {{VALUE}};', |
| 795 |
], |
| 796 |
] |
| 797 |
); |
| 798 |
|
| 799 |
$this->add_responsive_control( |
| 800 |
'slider_thumb_border_radius', |
| 801 |
[ |
| 802 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 803 |
'type' => Controls_Manager::DIMENSIONS, |
| 804 |
'size_units' => ['px', '%'], |
| 805 |
'default' => [ |
| 806 |
'top' => '50', |
| 807 |
'right' => '50', |
| 808 |
'bottom' => '50', |
| 809 |
'left' => '50', |
| 810 |
'unit' => '%', |
| 811 |
'isLinked' => true, |
| 812 |
], |
| 813 |
'selectors' => [ |
| 814 |
'{{WRAPPER}} .king-addons-pricing-slider__custom-thumb' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 815 |
], |
| 816 |
] |
| 817 |
); |
| 818 |
|
| 819 |
// Shadow |
| 820 |
$this->add_control( |
| 821 |
'slider_thumb_shadow_heading', |
| 822 |
[ |
| 823 |
'label' => esc_html__('Thumb Shadow', 'king-addons'), |
| 824 |
'type' => Controls_Manager::HEADING, |
| 825 |
'separator' => 'before', |
| 826 |
] |
| 827 |
); |
| 828 |
|
| 829 |
$this->add_control( |
| 830 |
'slider_thumb_shadow', |
| 831 |
[ |
| 832 |
'label' => esc_html__('Enable Shadow', 'king-addons'), |
| 833 |
'type' => Controls_Manager::SWITCHER, |
| 834 |
'label_on' => esc_html__('Yes', 'king-addons'), |
| 835 |
'label_off' => esc_html__('No', 'king-addons'), |
| 836 |
'return_value' => 'yes', |
| 837 |
'default' => 'yes', |
| 838 |
'prefix_class' => 'king-addons-slider-thumb-shadow-', |
| 839 |
] |
| 840 |
); |
| 841 |
|
| 842 |
$this->add_group_control( |
| 843 |
Group_Control_Box_Shadow::get_type(), |
| 844 |
[ |
| 845 |
'name' => 'slider_thumb_box_shadow', |
| 846 |
'label' => esc_html__('Thumb Shadow Settings', 'king-addons'), |
| 847 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__custom-thumb', |
| 848 |
'condition' => [ |
| 849 |
'slider_thumb_shadow' => 'yes', |
| 850 |
], |
| 851 |
] |
| 852 |
); |
| 853 |
|
| 854 |
// Current Value Indicator Styles |
| 855 |
$this->add_control( |
| 856 |
'current_value_indicator_heading', |
| 857 |
[ |
| 858 |
'label' => esc_html__('Current Value Indicator', 'king-addons'), |
| 859 |
'type' => Controls_Manager::HEADING, |
| 860 |
'separator' => 'before', |
| 861 |
'description' => esc_html__('Style the numeric value displayed below the thumb.', 'king-addons'), |
| 862 |
] |
| 863 |
); |
| 864 |
|
| 865 |
$this->add_control( |
| 866 |
'show_current_value_indicator', |
| 867 |
[ |
| 868 |
'label' => esc_html__('Show Current Value', 'king-addons'), |
| 869 |
'type' => Controls_Manager::SWITCHER, |
| 870 |
'label_on' => esc_html__('Show', 'king-addons'), |
| 871 |
'label_off' => esc_html__('Hide', 'king-addons'), |
| 872 |
'return_value' => 'yes', |
| 873 |
'default' => 'yes', |
| 874 |
// We can use prefix_class later if needed, for now control via render() |
| 875 |
] |
| 876 |
); |
| 877 |
|
| 878 |
$this->add_control( |
| 879 |
'current_value_bg_color', |
| 880 |
[ |
| 881 |
'label' => esc_html__('Background Color', 'king-addons'), |
| 882 |
'type' => Controls_Manager::COLOR, |
| 883 |
'default' => 'transparent', // Updated default |
| 884 |
'condition' => ['show_current_value_indicator' => 'yes'], |
| 885 |
'selectors' => [ |
| 886 |
'{{WRAPPER}} .king-addons-pricing-slider__current-value' => 'background-color: {{VALUE}};', |
| 887 |
], |
| 888 |
] |
| 889 |
); |
| 890 |
|
| 891 |
$this->add_control( |
| 892 |
'current_value_text_color', |
| 893 |
[ |
| 894 |
'label' => esc_html__('Text Color', 'king-addons'), |
| 895 |
'type' => Controls_Manager::COLOR, |
| 896 |
'default' => '#333333', // Updated default |
| 897 |
'condition' => ['show_current_value_indicator' => 'yes'], |
| 898 |
'selectors' => [ |
| 899 |
'{{WRAPPER}} .king-addons-pricing-slider__current-value' => 'color: {{VALUE}};', |
| 900 |
], |
| 901 |
] |
| 902 |
); |
| 903 |
|
| 904 |
$this->add_responsive_control( |
| 905 |
'current_value_padding', |
| 906 |
[ |
| 907 |
'label' => esc_html__('Padding', 'king-addons'), |
| 908 |
'type' => Controls_Manager::DIMENSIONS, |
| 909 |
'size_units' => ['px', 'em'], |
| 910 |
'default' => [ // Added default |
| 911 |
'top' => '2', |
| 912 |
'right' => '5', |
| 913 |
'bottom' => '2', |
| 914 |
'left' => '5', |
| 915 |
'unit' => 'px', |
| 916 |
'isLinked' => false, |
| 917 |
], |
| 918 |
'condition' => ['show_current_value_indicator' => 'yes'], |
| 919 |
'selectors' => [ |
| 920 |
'{{WRAPPER}} .king-addons-pricing-slider__current-value' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 921 |
], |
| 922 |
] |
| 923 |
); |
| 924 |
|
| 925 |
$this->add_responsive_control( |
| 926 |
'current_value_border_radius', |
| 927 |
[ |
| 928 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 929 |
'type' => Controls_Manager::SLIDER, |
| 930 |
'size_units' => ['px', '%'], |
| 931 |
'default' => [ // Added default |
| 932 |
'unit' => 'px', |
| 933 |
'size' => 3, |
| 934 |
], |
| 935 |
'condition' => ['show_current_value_indicator' => 'yes'], |
| 936 |
'range' => [ |
| 937 |
'px' => ['min' => 0, 'max' => 50], |
| 938 |
'%' => ['min' => 0, 'max' => 50], |
| 939 |
], |
| 940 |
'selectors' => [ |
| 941 |
'{{WRAPPER}} .king-addons-pricing-slider__current-value' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 942 |
], |
| 943 |
] |
| 944 |
); |
| 945 |
|
| 946 |
$this->add_group_control( |
| 947 |
Group_Control_Typography::get_type(), |
| 948 |
[ |
| 949 |
'name' => 'current_value_typography', |
| 950 |
'label' => esc_html__('Typography', 'king-addons'), |
| 951 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__current-value', |
| 952 |
'condition' => ['show_current_value_indicator' => 'yes'], |
| 953 |
'fields_options' => [ // Added default |
| 954 |
'font_weight' => ['default' => '600'], |
| 955 |
], |
| 956 |
] |
| 957 |
); |
| 958 |
|
| 959 |
// Range Values Styles |
| 960 |
$this->add_control( |
| 961 |
'range_values_indicator_heading', |
| 962 |
[ |
| 963 |
'label' => esc_html__('Range Min/Max Values', 'king-addons'), |
| 964 |
'type' => Controls_Manager::HEADING, |
| 965 |
'separator' => 'before', |
| 966 |
] |
| 967 |
); |
| 968 |
|
| 969 |
$this->add_control( |
| 970 |
'range_values_text_color', |
| 971 |
[ |
| 972 |
'label' => esc_html__('Text Color', 'king-addons'), |
| 973 |
'type' => Controls_Manager::COLOR, |
| 974 |
'default' => '#555555', // Updated default |
| 975 |
'selectors' => [ |
| 976 |
'{{WRAPPER}} .king-addons-pricing-slider__range-min-value, {{WRAPPER}} .king-addons-pricing-slider__range-max-value' => 'color: {{VALUE}};', |
| 977 |
], |
| 978 |
] |
| 979 |
); |
| 980 |
|
| 981 |
$this->add_group_control( |
| 982 |
Group_Control_Typography::get_type(), |
| 983 |
[ |
| 984 |
'name' => 'range_values_typography', |
| 985 |
'label' => esc_html__('Typography', 'king-addons'), |
| 986 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__range-min-value, {{WRAPPER}} .king-addons-pricing-slider__range-max-value', |
| 987 |
] |
| 988 |
); |
| 989 |
|
| 990 |
$this->add_control( |
| 991 |
'range_values_bg_color', |
| 992 |
[ |
| 993 |
'label' => esc_html__('Background Color', 'king-addons'), |
| 994 |
'type' => Controls_Manager::COLOR, |
| 995 |
'selectors' => [ |
| 996 |
'{{WRAPPER}} .king-addons-pricing-slider__range-min-value, {{WRAPPER}} .king-addons-pricing-slider__range-max-value' => 'background-color: {{VALUE}};', |
| 997 |
], |
| 998 |
] |
| 999 |
); |
| 1000 |
|
| 1001 |
$this->add_responsive_control( |
| 1002 |
'range_values_padding', |
| 1003 |
[ |
| 1004 |
'label' => esc_html__('Padding', 'king-addons'), |
| 1005 |
'type' => Controls_Manager::DIMENSIONS, |
| 1006 |
'size_units' => ['px', 'em'], |
| 1007 |
'selectors' => [ |
| 1008 |
'{{WRAPPER}} .king-addons-pricing-slider__range-min-value, {{WRAPPER}} .king-addons-pricing-slider__range-max-value' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1009 |
], |
| 1010 |
] |
| 1011 |
); |
| 1012 |
|
| 1013 |
$this->add_responsive_control( |
| 1014 |
'range_values_border_radius', |
| 1015 |
[ |
| 1016 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 1017 |
'type' => Controls_Manager::SLIDER, |
| 1018 |
'size_units' => ['px', '%'], |
| 1019 |
'range' => [ |
| 1020 |
'px' => ['min' => 0, 'max' => 50], |
| 1021 |
'%' => ['min' => 0, 'max' => 50], |
| 1022 |
], |
| 1023 |
'selectors' => [ |
| 1024 |
'{{WRAPPER}} .king-addons-pricing-slider__range-min-value, {{WRAPPER}} .king-addons-pricing-slider__range-max-value' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 1025 |
], |
| 1026 |
] |
| 1027 |
); |
| 1028 |
|
| 1029 |
$this->add_responsive_control( |
| 1030 |
'range_values_margin', |
| 1031 |
[ |
| 1032 |
'label' => esc_html__('Margin (Around Container)', 'king-addons'), |
| 1033 |
'type' => Controls_Manager::DIMENSIONS, |
| 1034 |
'size_units' => ['px', 'em', '%'], |
| 1035 |
'default' => [ |
| 1036 |
'top' => 5, // Keep top margin |
| 1037 |
'right' => 0, |
| 1038 |
'bottom' => 0, |
| 1039 |
'left' => 0, |
| 1040 |
'unit' => 'px', |
| 1041 |
], |
| 1042 |
'selectors' => [ |
| 1043 |
'{{WRAPPER}} .king-addons-pricing-slider__range-values' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1044 |
], |
| 1045 |
'separator' => 'before', |
| 1046 |
] |
| 1047 |
); |
| 1048 |
|
| 1049 |
$this->end_controls_section(); |
| 1050 |
|
| 1051 |
// Style Tab |
| 1052 |
$this->start_controls_section( |
| 1053 |
'section_control_group_style', |
| 1054 |
[ |
| 1055 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Control Groups', 'king-addons'), |
| 1056 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1057 |
] |
| 1058 |
); |
| 1059 |
|
| 1060 |
$this->add_control( |
| 1061 |
'control_group_background_color', |
| 1062 |
[ |
| 1063 |
'label' => esc_html__('Background Color', 'king-addons'), |
| 1064 |
'type' => Controls_Manager::COLOR, |
| 1065 |
'default' => '#0000000A', // Updated default |
| 1066 |
'selectors' => [ |
| 1067 |
'{{WRAPPER}} .king-addons-pricing-slider__control-group' => 'background-color: {{VALUE}};', |
| 1068 |
], |
| 1069 |
] |
| 1070 |
); |
| 1071 |
|
| 1072 |
$this->add_control( |
| 1073 |
'control_group_border_radius', |
| 1074 |
[ |
| 1075 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 1076 |
'type' => Controls_Manager::SLIDER, |
| 1077 |
'size_units' => ['px', '%'], |
| 1078 |
'range' => [ |
| 1079 |
'px' => [ |
| 1080 |
'min' => 0, |
| 1081 |
'max' => 50, |
| 1082 |
], |
| 1083 |
'%' => [ |
| 1084 |
'min' => 0, |
| 1085 |
'max' => 100, |
| 1086 |
], |
| 1087 |
], |
| 1088 |
'default' => [ |
| 1089 |
'unit' => 'px', |
| 1090 |
'size' => 6, |
| 1091 |
], |
| 1092 |
'selectors' => [ |
| 1093 |
'{{WRAPPER}} .king-addons-pricing-slider__control-group' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 1094 |
], |
| 1095 |
] |
| 1096 |
); |
| 1097 |
|
| 1098 |
$this->add_responsive_control( |
| 1099 |
'control_group_padding', |
| 1100 |
[ |
| 1101 |
'label' => esc_html__('Padding', 'king-addons'), |
| 1102 |
'type' => Controls_Manager::DIMENSIONS, |
| 1103 |
'size_units' => ['px', 'em', '%'], |
| 1104 |
'default' => [ |
| 1105 |
'top' => 10, |
| 1106 |
'right' => 10, |
| 1107 |
'bottom' => 10, |
| 1108 |
'left' => 10, |
| 1109 |
'unit' => 'px', |
| 1110 |
], |
| 1111 |
'selectors' => [ |
| 1112 |
'{{WRAPPER}} .king-addons-pricing-slider__control-group' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1113 |
], |
| 1114 |
] |
| 1115 |
); |
| 1116 |
|
| 1117 |
$this->add_responsive_control( |
| 1118 |
'control_group_margin', |
| 1119 |
[ |
| 1120 |
'label' => esc_html__('Margin', 'king-addons'), |
| 1121 |
'type' => Controls_Manager::DIMENSIONS, |
| 1122 |
'size_units' => ['px', 'em', '%'], |
| 1123 |
'default' => [ |
| 1124 |
'top' => 0, |
| 1125 |
'right' => 0, |
| 1126 |
'bottom' => 25, // Updated default |
| 1127 |
'left' => 0, |
| 1128 |
'unit' => 'px', |
| 1129 |
], |
| 1130 |
'selectors' => [ |
| 1131 |
'{{WRAPPER}} .king-addons-pricing-slider__control-group' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1132 |
], |
| 1133 |
] |
| 1134 |
); |
| 1135 |
|
| 1136 |
$this->end_controls_section(); |
| 1137 |
|
| 1138 |
// Price Style |
| 1139 |
$this->start_controls_section( |
| 1140 |
'section_price_style', |
| 1141 |
[ |
| 1142 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Price', 'king-addons'), |
| 1143 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1144 |
] |
| 1145 |
); |
| 1146 |
|
| 1147 |
$this->add_control( |
| 1148 |
'price_color', |
| 1149 |
[ |
| 1150 |
'label' => esc_html__('Price Color', 'king-addons'), |
| 1151 |
'type' => Controls_Manager::COLOR, |
| 1152 |
'default' => '#0073e6', // Updated default |
| 1153 |
'selectors' => [ |
| 1154 |
'{{WRAPPER}} .king-addons-pricing-slider__price' => 'color: {{VALUE}};', |
| 1155 |
], |
| 1156 |
] |
| 1157 |
); |
| 1158 |
|
| 1159 |
$this->add_group_control( |
| 1160 |
Group_Control_Typography::get_type(), |
| 1161 |
[ |
| 1162 |
'name' => 'price_typography', |
| 1163 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__price', |
| 1164 |
'fields_options' => [ // Added default |
| 1165 |
'font_size' => ['default' => ['unit' => 'px', 'size' => 48]], |
| 1166 |
'font_weight' => ['default' => '700'], |
| 1167 |
], |
| 1168 |
] |
| 1169 |
); |
| 1170 |
|
| 1171 |
$this->add_control( |
| 1172 |
'currency_color', |
| 1173 |
[ |
| 1174 |
'label' => esc_html__('Currency Color', 'king-addons'), |
| 1175 |
'type' => Controls_Manager::COLOR, |
| 1176 |
'default' => '#0073e6', // Updated default |
| 1177 |
'selectors' => [ |
| 1178 |
'{{WRAPPER}} .king-addons-pricing-slider__currency' => 'color: {{VALUE}};', |
| 1179 |
], |
| 1180 |
'separator' => 'before', |
| 1181 |
] |
| 1182 |
); |
| 1183 |
|
| 1184 |
$this->add_group_control( |
| 1185 |
Group_Control_Typography::get_type(), |
| 1186 |
[ |
| 1187 |
'name' => 'currency_typography', |
| 1188 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__currency', |
| 1189 |
] |
| 1190 |
); |
| 1191 |
|
| 1192 |
$this->add_control( |
| 1193 |
'period_color', |
| 1194 |
[ |
| 1195 |
'label' => esc_html__('Period Color', 'king-addons'), |
| 1196 |
'type' => Controls_Manager::COLOR, |
| 1197 |
'default' => '#777777', // Updated default |
| 1198 |
'selectors' => [ |
| 1199 |
'{{WRAPPER}} .king-addons-pricing-slider__period' => 'color: {{VALUE}};', |
| 1200 |
], |
| 1201 |
'separator' => 'before', |
| 1202 |
] |
| 1203 |
); |
| 1204 |
|
| 1205 |
$this->add_group_control( |
| 1206 |
Group_Control_Typography::get_type(), |
| 1207 |
[ |
| 1208 |
'name' => 'period_typography', |
| 1209 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__period', |
| 1210 |
'fields_options' => [ // Added default |
| 1211 |
'font_size' => ['default' => ['unit' => 'px', 'size' => 16]], |
| 1212 |
'font_weight' => ['default' => '400'], |
| 1213 |
], |
| 1214 |
] |
| 1215 |
); |
| 1216 |
|
| 1217 |
$this->add_responsive_control( |
| 1218 |
'price_spacing', |
| 1219 |
[ |
| 1220 |
'label' => esc_html__('Spacing', 'king-addons'), |
| 1221 |
'type' => Controls_Manager::SLIDER, |
| 1222 |
'size_units' => ['px', 'em', 'rem'], |
| 1223 |
'range' => [ |
| 1224 |
'px' => [ |
| 1225 |
'min' => 0, |
| 1226 |
'max' => 100, |
| 1227 |
], |
| 1228 |
], |
| 1229 |
'default' => [ // Added default |
| 1230 |
'unit' => 'px', |
| 1231 |
'size' => 30, |
| 1232 |
], |
| 1233 |
'selectors' => [ |
| 1234 |
'{{WRAPPER}} .king-addons-pricing-slider__display' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 1235 |
], |
| 1236 |
] |
| 1237 |
); |
| 1238 |
|
| 1239 |
$this->add_control( |
| 1240 |
'price_alignment', |
| 1241 |
[ |
| 1242 |
'label' => esc_html__('Alignment', 'king-addons'), |
| 1243 |
'type' => Controls_Manager::CHOOSE, |
| 1244 |
'options' => [ |
| 1245 |
'left' => [ |
| 1246 |
'title' => esc_html__('Left', 'king-addons'), |
| 1247 |
'icon' => 'eicon-text-align-left', |
| 1248 |
], |
| 1249 |
'center' => [ |
| 1250 |
'title' => esc_html__('Center', 'king-addons'), |
| 1251 |
'icon' => 'eicon-text-align-center', |
| 1252 |
], |
| 1253 |
'right' => [ |
| 1254 |
'title' => esc_html__('Right', 'king-addons'), |
| 1255 |
'icon' => 'eicon-text-align-right', |
| 1256 |
], |
| 1257 |
], |
| 1258 |
'default' => 'center', |
| 1259 |
'selectors' => [ |
| 1260 |
'{{WRAPPER}} .king-addons-pricing-slider__display' => 'text-align: {{VALUE}};', |
| 1261 |
], |
| 1262 |
] |
| 1263 |
); |
| 1264 |
|
| 1265 |
$this->end_controls_section(); |
| 1266 |
|
| 1267 |
// Features Style |
| 1268 |
$this->start_controls_section( |
| 1269 |
'section_features_style', |
| 1270 |
[ |
| 1271 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Features', 'king-addons'), |
| 1272 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1273 |
'condition' => [ |
| 1274 |
'show_features' => 'yes', |
| 1275 |
], |
| 1276 |
] |
| 1277 |
); |
| 1278 |
|
| 1279 |
$this->add_control( |
| 1280 |
'feature_item_color', |
| 1281 |
[ |
| 1282 |
'label' => esc_html__('Text Color', 'king-addons'), |
| 1283 |
'type' => Controls_Manager::COLOR, |
| 1284 |
'default' => '#333333', // Updated default |
| 1285 |
'selectors' => [ |
| 1286 |
'{{WRAPPER}} .king-addons-pricing-slider__feature-item' => 'color: {{VALUE}};', |
| 1287 |
], |
| 1288 |
] |
| 1289 |
); |
| 1290 |
|
| 1291 |
$this->add_group_control( |
| 1292 |
Group_Control_Typography::get_type(), |
| 1293 |
[ |
| 1294 |
'name' => 'feature_typography', |
| 1295 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__feature-item', |
| 1296 |
] |
| 1297 |
); |
| 1298 |
|
| 1299 |
$this->add_control( |
| 1300 |
'feature_included_color', |
| 1301 |
[ |
| 1302 |
'label' => esc_html__('Included Icon Color', 'king-addons'), |
| 1303 |
'type' => Controls_Manager::COLOR, |
| 1304 |
'default' => '#28a745', // Updated default (Green) |
| 1305 |
'selectors' => [ |
| 1306 |
'{{WRAPPER}} .king-addons-pricing-slider__feature-item.king-addons-feature-included .king-addons-pricing-slider__feature-included i' => 'color: {{VALUE}};', |
| 1307 |
], |
| 1308 |
'separator' => 'before', |
| 1309 |
] |
| 1310 |
); |
| 1311 |
|
| 1312 |
$this->add_control( |
| 1313 |
'feature_excluded_color', |
| 1314 |
[ |
| 1315 |
'label' => esc_html__('Excluded Icon Color', 'king-addons'), |
| 1316 |
'type' => Controls_Manager::COLOR, |
| 1317 |
'default' => '#aaaaaa', // Updated default (Grey) |
| 1318 |
'selectors' => [ |
| 1319 |
'{{WRAPPER}} .king-addons-pricing-slider__feature-item.king-addons-feature-excluded .king-addons-pricing-slider__feature-excluded i' => 'color: {{VALUE}};', |
| 1320 |
], |
| 1321 |
] |
| 1322 |
); |
| 1323 |
|
| 1324 |
$this->add_control( |
| 1325 |
'feature_item_bg_color', |
| 1326 |
[ |
| 1327 |
'label' => esc_html__('Default Background Color', 'king-addons'), |
| 1328 |
'type' => Controls_Manager::COLOR, |
| 1329 |
'default' => 'transparent', // Updated default |
| 1330 |
'selectors' => [ |
| 1331 |
'{{WRAPPER}} .king-addons-pricing-slider__feature-item' => 'background-color: {{VALUE}};', |
| 1332 |
], |
| 1333 |
'separator' => 'before', |
| 1334 |
'description' => esc_html__('Default background for all feature items. Specific backgrounds can be set below.', 'king-addons'), |
| 1335 |
] |
| 1336 |
); |
| 1337 |
|
| 1338 |
// Included Feature Styles Heading |
| 1339 |
$this->add_control( |
| 1340 |
'feature_included_style_heading', |
| 1341 |
[ |
| 1342 |
'label' => esc_html__('Included Feature Styles', 'king-addons'), |
| 1343 |
'type' => Controls_Manager::HEADING, |
| 1344 |
'separator' => 'before', |
| 1345 |
] |
| 1346 |
); |
| 1347 |
|
| 1348 |
$this->add_control( |
| 1349 |
'feature_item_bg_color_included', |
| 1350 |
[ |
| 1351 |
'label' => esc_html__('Background Color (Included)', 'king-addons'), |
| 1352 |
'type' => Controls_Manager::COLOR, |
| 1353 |
'default' => 'transparent', // Updated default |
| 1354 |
'selectors' => [ |
| 1355 |
'{{WRAPPER}} .king-addons-pricing-slider__feature-item.king-addons-feature-included' => 'background-color: {{VALUE}};', |
| 1356 |
], |
| 1357 |
] |
| 1358 |
); |
| 1359 |
|
| 1360 |
$this->add_control( |
| 1361 |
'feature_text_color_included', |
| 1362 |
[ |
| 1363 |
'label' => esc_html__('Text Color (Included)', 'king-addons'), |
| 1364 |
'type' => Controls_Manager::COLOR, |
| 1365 |
'default' => '#333333', // Updated default |
| 1366 |
'selectors' => [ |
| 1367 |
'{{WRAPPER}} .king-addons-pricing-slider__feature-item.king-addons-feature-included .king-addons-pricing-slider__feature-text' => 'color: {{VALUE}};', |
| 1368 |
], |
| 1369 |
] |
| 1370 |
); |
| 1371 |
|
| 1372 |
$this->add_group_control( |
| 1373 |
Group_Control_Typography::get_type(), |
| 1374 |
[ |
| 1375 |
'name' => 'feature_typography_included', |
| 1376 |
'label' => esc_html__('Typography (Included)', 'king-addons'), |
| 1377 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__feature-item.king-addons-feature-included .king-addons-pricing-slider__feature-text', |
| 1378 |
] |
| 1379 |
); |
| 1380 |
|
| 1381 |
// Excluded Feature Styles Heading |
| 1382 |
$this->add_control( |
| 1383 |
'feature_excluded_style_heading', |
| 1384 |
[ |
| 1385 |
'label' => esc_html__('Excluded Feature Styles', 'king-addons'), |
| 1386 |
'type' => Controls_Manager::HEADING, |
| 1387 |
'separator' => 'before', |
| 1388 |
] |
| 1389 |
); |
| 1390 |
|
| 1391 |
$this->add_control( |
| 1392 |
'feature_item_bg_color_excluded', |
| 1393 |
[ |
| 1394 |
'label' => esc_html__('Background Color (Excluded)', 'king-addons'), |
| 1395 |
'type' => Controls_Manager::COLOR, |
| 1396 |
'default' => 'transparent', // Updated default |
| 1397 |
'selectors' => [ |
| 1398 |
'{{WRAPPER}} .king-addons-pricing-slider__feature-item.king-addons-feature-excluded' => 'background-color: {{VALUE}};', |
| 1399 |
], |
| 1400 |
] |
| 1401 |
); |
| 1402 |
|
| 1403 |
$this->add_control( |
| 1404 |
'feature_text_color_excluded', |
| 1405 |
[ |
| 1406 |
'label' => esc_html__('Text Color (Excluded)', 'king-addons'), |
| 1407 |
'type' => Controls_Manager::COLOR, |
| 1408 |
'default' => '#999999', // Updated default |
| 1409 |
'selectors' => [ |
| 1410 |
'{{WRAPPER}} .king-addons-pricing-slider__feature-item.king-addons-feature-excluded .king-addons-pricing-slider__feature-text' => 'color: {{VALUE}};', |
| 1411 |
], |
| 1412 |
] |
| 1413 |
); |
| 1414 |
|
| 1415 |
$this->add_group_control( |
| 1416 |
Group_Control_Typography::get_type(), |
| 1417 |
[ |
| 1418 |
'name' => 'feature_typography_excluded', |
| 1419 |
'label' => esc_html__('Typography (Excluded)', 'king-addons'), |
| 1420 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__feature-item.king-addons-feature-excluded .king-addons-pricing-slider__feature-text', |
| 1421 |
] |
| 1422 |
); |
| 1423 |
|
| 1424 |
// Feature Item Border & Shadow Heading |
| 1425 |
$this->add_control( |
| 1426 |
'feature_border_shadow_heading', |
| 1427 |
[ |
| 1428 |
'label' => esc_html__('Feature Item Border & Shadow', 'king-addons'), |
| 1429 |
'type' => Controls_Manager::HEADING, |
| 1430 |
'separator' => 'before', |
| 1431 |
] |
| 1432 |
); |
| 1433 |
|
| 1434 |
$this->add_group_control( |
| 1435 |
\Elementor\Group_Control_Border::get_type(), |
| 1436 |
[ |
| 1437 |
'name' => 'feature_border', |
| 1438 |
'label' => esc_html__('Border (Default)', 'king-addons'), |
| 1439 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__feature-item', |
| 1440 |
] |
| 1441 |
); |
| 1442 |
|
| 1443 |
$this->add_control( |
| 1444 |
'feature_border_color_included', |
| 1445 |
[ |
| 1446 |
'label' => esc_html__('Border Color (Included)', 'king-addons'), |
| 1447 |
'type' => Controls_Manager::COLOR, |
| 1448 |
'selectors' => [ |
| 1449 |
'{{WRAPPER}} .king-addons-pricing-slider__feature-item.king-addons-feature-included' => 'border-color: {{VALUE}};', |
| 1450 |
], |
| 1451 |
'condition' => [ |
| 1452 |
'feature_border_border!' => '', // Only show if a border type is selected |
| 1453 |
], |
| 1454 |
] |
| 1455 |
); |
| 1456 |
|
| 1457 |
$this->add_control( |
| 1458 |
'feature_border_color_excluded', |
| 1459 |
[ |
| 1460 |
'label' => esc_html__('Border Color (Excluded)', 'king-addons'), |
| 1461 |
'type' => Controls_Manager::COLOR, |
| 1462 |
'selectors' => [ |
| 1463 |
'{{WRAPPER}} .king-addons-pricing-slider__feature-item.king-addons-feature-excluded' => 'border-color: {{VALUE}};', |
| 1464 |
], |
| 1465 |
'condition' => [ |
| 1466 |
'feature_border_border!' => '', // Only show if a border type is selected |
| 1467 |
], |
| 1468 |
] |
| 1469 |
); |
| 1470 |
|
| 1471 |
$this->add_responsive_control( |
| 1472 |
'feature_border_radius', |
| 1473 |
[ |
| 1474 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 1475 |
'type' => Controls_Manager::DIMENSIONS, |
| 1476 |
'size_units' => ['px', '%', 'em'], |
| 1477 |
'selectors' => [ |
| 1478 |
'{{WRAPPER}} .king-addons-pricing-slider__feature-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1479 |
], |
| 1480 |
'separator' => 'after', // Add separator after border controls |
| 1481 |
] |
| 1482 |
); |
| 1483 |
|
| 1484 |
$this->add_responsive_control( |
| 1485 |
'feature_spacing', |
| 1486 |
[ |
| 1487 |
'label' => esc_html__('Spacing Between', 'king-addons'), |
| 1488 |
'type' => Controls_Manager::SLIDER, |
| 1489 |
'size_units' => ['px', 'em', 'rem'], |
| 1490 |
'range' => [ |
| 1491 |
'px' => [ |
| 1492 |
'min' => 0, |
| 1493 |
'max' => 50, |
| 1494 |
], |
| 1495 |
], |
| 1496 |
'default' => [ // Added default |
| 1497 |
'unit' => 'px', |
| 1498 |
'size' => 10, |
| 1499 |
], |
| 1500 |
'selectors' => [ |
| 1501 |
'{{WRAPPER}} .king-addons-pricing-slider__feature-item:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 1502 |
], |
| 1503 |
] |
| 1504 |
); |
| 1505 |
|
| 1506 |
$this->add_responsive_control( |
| 1507 |
'feature_padding', |
| 1508 |
[ |
| 1509 |
'label' => esc_html__('Padding', 'king-addons'), |
| 1510 |
'type' => Controls_Manager::DIMENSIONS, |
| 1511 |
'size_units' => ['px', 'em', '%'], |
| 1512 |
'default' => [ // Added default |
| 1513 |
'top' => '5', |
| 1514 |
'right' => '0', |
| 1515 |
'bottom' => '5', |
| 1516 |
'left' => '0', |
| 1517 |
'unit' => 'px', |
| 1518 |
'isLinked' => false, |
| 1519 |
], |
| 1520 |
'selectors' => [ |
| 1521 |
'{{WRAPPER}} .king-addons-pricing-slider__feature-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1522 |
], |
| 1523 |
] |
| 1524 |
); |
| 1525 |
|
| 1526 |
$this->add_group_control( |
| 1527 |
Group_Control_Box_Shadow::get_type(), |
| 1528 |
[ |
| 1529 |
'name' => 'feature_box_shadow', |
| 1530 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__feature-item', |
| 1531 |
] |
| 1532 |
); |
| 1533 |
|
| 1534 |
$this->end_controls_section(); |
| 1535 |
|
| 1536 |
// Button Style |
| 1537 |
$this->start_controls_section( |
| 1538 |
'section_button_style', |
| 1539 |
[ |
| 1540 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Button', 'king-addons'), |
| 1541 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1542 |
'condition' => [ |
| 1543 |
'show_button' => 'yes', |
| 1544 |
], |
| 1545 |
] |
| 1546 |
); |
| 1547 |
|
| 1548 |
$this->start_controls_tabs('button_style_tabs'); |
| 1549 |
|
| 1550 |
$this->start_controls_tab( |
| 1551 |
'button_normal_tab', |
| 1552 |
[ |
| 1553 |
'label' => esc_html__('Normal', 'king-addons'), |
| 1554 |
] |
| 1555 |
); |
| 1556 |
|
| 1557 |
$this->add_control( |
| 1558 |
'button_text_color', |
| 1559 |
[ |
| 1560 |
'label' => esc_html__('Text Color', 'king-addons'), |
| 1561 |
'type' => Controls_Manager::COLOR, |
| 1562 |
'default' => '#ffffff', // Updated default |
| 1563 |
'selectors' => [ |
| 1564 |
'{{WRAPPER}} .king-addons-pricing-slider__button, {{WRAPPER}} .king-addons-pricing-slider__add-to-cart' => 'color: {{VALUE}};', |
| 1565 |
], |
| 1566 |
] |
| 1567 |
); |
| 1568 |
|
| 1569 |
$this->add_control( |
| 1570 |
'button_background_color', |
| 1571 |
[ |
| 1572 |
'label' => esc_html__('Background Color', 'king-addons'), |
| 1573 |
'type' => Controls_Manager::COLOR, |
| 1574 |
'default' => '#0073e6', // Updated default |
| 1575 |
'selectors' => [ |
| 1576 |
'{{WRAPPER}} .king-addons-pricing-slider__button, {{WRAPPER}} .king-addons-pricing-slider__add-to-cart' => 'background-color: {{VALUE}};', |
| 1577 |
], |
| 1578 |
] |
| 1579 |
); |
| 1580 |
|
| 1581 |
$this->end_controls_tab(); |
| 1582 |
|
| 1583 |
$this->start_controls_tab( |
| 1584 |
'button_hover_tab', |
| 1585 |
[ |
| 1586 |
'label' => esc_html__('Hover', 'king-addons'), |
| 1587 |
] |
| 1588 |
); |
| 1589 |
|
| 1590 |
$this->add_control( |
| 1591 |
'button_hover_text_color', |
| 1592 |
[ |
| 1593 |
'label' => esc_html__('Text Color', 'king-addons'), |
| 1594 |
'type' => Controls_Manager::COLOR, |
| 1595 |
'default' => '#ffffff', // Updated default |
| 1596 |
'selectors' => [ |
| 1597 |
'{{WRAPPER}} .king-addons-pricing-slider__button:hover, {{WRAPPER}} .king-addons-pricing-slider__add-to-cart:hover' => 'color: {{VALUE}};', |
| 1598 |
], |
| 1599 |
] |
| 1600 |
); |
| 1601 |
|
| 1602 |
$this->add_control( |
| 1603 |
'button_hover_background_color', |
| 1604 |
[ |
| 1605 |
'label' => esc_html__('Background Color', 'king-addons'), |
| 1606 |
'type' => Controls_Manager::COLOR, |
| 1607 |
'default' => '#005bb5', // Updated default (darker blue) |
| 1608 |
'selectors' => [ |
| 1609 |
'{{WRAPPER}} .king-addons-pricing-slider__button:hover, {{WRAPPER}} .king-addons-pricing-slider__add-to-cart:hover' => 'background-color: {{VALUE}};', |
| 1610 |
], |
| 1611 |
] |
| 1612 |
); |
| 1613 |
|
| 1614 |
$this->add_control( |
| 1615 |
'button_hover_border_color', |
| 1616 |
[ |
| 1617 |
'label' => esc_html__('Border Color', 'king-addons'), |
| 1618 |
'type' => Controls_Manager::COLOR, |
| 1619 |
'selectors' => [ |
| 1620 |
'{{WRAPPER}} .king-addons-pricing-slider__button:hover, {{WRAPPER}} .king-addons-pricing-slider__add-to-cart:hover' => 'border-color: {{VALUE}};', |
| 1621 |
], |
| 1622 |
'condition' => [ |
| 1623 |
'button_border_border!' => '', |
| 1624 |
], |
| 1625 |
] |
| 1626 |
); |
| 1627 |
|
| 1628 |
$this->add_control( |
| 1629 |
'button_hover_animation', |
| 1630 |
[ |
| 1631 |
'label' => esc_html__('Hover Animation', 'king-addons'), |
| 1632 |
'type' => Controls_Manager::HOVER_ANIMATION, |
| 1633 |
// Apply animation class to both buttons? Might need JS intervention if using Add to Cart |
| 1634 |
] |
| 1635 |
); |
| 1636 |
|
| 1637 |
$this->end_controls_tab(); |
| 1638 |
|
| 1639 |
$this->end_controls_tabs(); |
| 1640 |
|
| 1641 |
$this->add_group_control( |
| 1642 |
Group_Control_Typography::get_type(), |
| 1643 |
[ |
| 1644 |
'name' => 'button_typography', |
| 1645 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__button, {{WRAPPER}} .king-addons-pricing-slider__add-to-cart', |
| 1646 |
'separator' => 'before', |
| 1647 |
'fields_options' => [ // Added default |
| 1648 |
'font_weight' => ['default' => '600'], |
| 1649 |
], |
| 1650 |
] |
| 1651 |
); |
| 1652 |
|
| 1653 |
$this->add_responsive_control( |
| 1654 |
'button_padding', |
| 1655 |
[ |
| 1656 |
'label' => esc_html__('Padding', 'king-addons'), |
| 1657 |
'type' => Controls_Manager::DIMENSIONS, |
| 1658 |
'size_units' => ['px', 'em', '%'], |
| 1659 |
'default' => [ // Added default |
| 1660 |
'top' => '12', |
| 1661 |
'right' => '24', |
| 1662 |
'bottom' => '12', |
| 1663 |
'left' => '24', |
| 1664 |
'unit' => 'px', |
| 1665 |
'isLinked' => false, |
| 1666 |
], |
| 1667 |
'selectors' => [ |
| 1668 |
'{{WRAPPER}} .king-addons-pricing-slider__button, {{WRAPPER}} .king-addons-pricing-slider__add-to-cart' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1669 |
], |
| 1670 |
] |
| 1671 |
); |
| 1672 |
|
| 1673 |
$this->add_group_control( |
| 1674 |
Group_Control_Box_Shadow::get_type(), |
| 1675 |
[ |
| 1676 |
'name' => 'button_box_shadow', |
| 1677 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__button, {{WRAPPER}} .king-addons-pricing-slider__add-to-cart', |
| 1678 |
] |
| 1679 |
); |
| 1680 |
|
| 1681 |
$this->add_control( |
| 1682 |
'button_alignment', |
| 1683 |
[ |
| 1684 |
'label' => esc_html__('Alignment', 'king-addons'), |
| 1685 |
'type' => Controls_Manager::CHOOSE, |
| 1686 |
'options' => [ |
| 1687 |
'left' => [ |
| 1688 |
'title' => esc_html__('Left', 'king-addons'), |
| 1689 |
'icon' => 'eicon-text-align-left', |
| 1690 |
], |
| 1691 |
'center' => [ |
| 1692 |
'title' => esc_html__('Center', 'king-addons'), |
| 1693 |
'icon' => 'eicon-text-align-center', |
| 1694 |
], |
| 1695 |
'right' => [ |
| 1696 |
'title' => esc_html__('Right', 'king-addons'), |
| 1697 |
'icon' => 'eicon-text-align-right', |
| 1698 |
], |
| 1699 |
], |
| 1700 |
'default' => 'center', |
| 1701 |
'selectors' => [ |
| 1702 |
'{{WRAPPER}} .king-addons-pricing-slider__actions' => 'text-align: {{VALUE}};', |
| 1703 |
], |
| 1704 |
] |
| 1705 |
); |
| 1706 |
|
| 1707 |
$this->end_controls_section(); |
| 1708 |
|
| 1709 |
// Range Labels Style Section |
| 1710 |
$this->start_controls_section( |
| 1711 |
'section_range_labels_style', |
| 1712 |
[ |
| 1713 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Range Labels (Min/Max)', 'king-addons'), |
| 1714 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1715 |
] |
| 1716 |
); |
| 1717 |
|
| 1718 |
// Minimum Label Styles |
| 1719 |
$this->add_control( |
| 1720 |
'min_label_style_heading', |
| 1721 |
[ |
| 1722 |
'label' => esc_html__('Minimum Label Style', 'king-addons'), |
| 1723 |
'type' => Controls_Manager::HEADING, |
| 1724 |
] |
| 1725 |
); |
| 1726 |
|
| 1727 |
$this->add_control( |
| 1728 |
'min_label_text_color', |
| 1729 |
[ |
| 1730 |
'label' => esc_html__('Text Color', 'king-addons'), |
| 1731 |
'type' => Controls_Manager::COLOR, |
| 1732 |
'default' => '#555555', // Updated default |
| 1733 |
'selectors' => [ |
| 1734 |
'{{WRAPPER}} .king-addons-pricing-slider__range-min' => 'color: {{VALUE}};', |
| 1735 |
], |
| 1736 |
] |
| 1737 |
); |
| 1738 |
|
| 1739 |
$this->add_group_control( |
| 1740 |
Group_Control_Typography::get_type(), |
| 1741 |
[ |
| 1742 |
'name' => 'min_label_typography', |
| 1743 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__range-min', |
| 1744 |
] |
| 1745 |
); |
| 1746 |
|
| 1747 |
$this->add_control( |
| 1748 |
'min_label_bg_color', |
| 1749 |
[ |
| 1750 |
'label' => esc_html__('Background Color', 'king-addons'), |
| 1751 |
'type' => Controls_Manager::COLOR, |
| 1752 |
'selectors' => [ |
| 1753 |
'{{WRAPPER}} .king-addons-pricing-slider__range-min' => 'background-color: {{VALUE}};', |
| 1754 |
], |
| 1755 |
] |
| 1756 |
); |
| 1757 |
|
| 1758 |
$this->add_responsive_control( |
| 1759 |
'min_label_padding', |
| 1760 |
[ |
| 1761 |
'label' => esc_html__('Padding', 'king-addons'), |
| 1762 |
'type' => Controls_Manager::DIMENSIONS, |
| 1763 |
'size_units' => ['px', 'em', '%'], |
| 1764 |
'selectors' => [ |
| 1765 |
'{{WRAPPER}} .king-addons-pricing-slider__range-min' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1766 |
], |
| 1767 |
] |
| 1768 |
); |
| 1769 |
|
| 1770 |
$this->add_group_control( |
| 1771 |
\Elementor\Group_Control_Border::get_type(), |
| 1772 |
[ |
| 1773 |
'name' => 'min_label_border', |
| 1774 |
'label' => esc_html__('Border', 'king-addons'), |
| 1775 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__range-min', |
| 1776 |
] |
| 1777 |
); |
| 1778 |
|
| 1779 |
$this->add_responsive_control( |
| 1780 |
'min_label_border_radius', |
| 1781 |
[ |
| 1782 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 1783 |
'type' => Controls_Manager::DIMENSIONS, |
| 1784 |
'size_units' => ['px', '%', 'em'], |
| 1785 |
'selectors' => [ |
| 1786 |
'{{WRAPPER}} .king-addons-pricing-slider__range-min' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1787 |
], |
| 1788 |
] |
| 1789 |
); |
| 1790 |
|
| 1791 |
// Maximum Label Styles |
| 1792 |
$this->add_control( |
| 1793 |
'max_label_style_heading', |
| 1794 |
[ |
| 1795 |
'label' => esc_html__('Maximum Label Style', 'king-addons'), |
| 1796 |
'type' => Controls_Manager::HEADING, |
| 1797 |
'separator' => 'before', |
| 1798 |
] |
| 1799 |
); |
| 1800 |
|
| 1801 |
$this->add_control( |
| 1802 |
'max_label_text_color', |
| 1803 |
[ |
| 1804 |
'label' => esc_html__('Text Color', 'king-addons'), |
| 1805 |
'type' => Controls_Manager::COLOR, |
| 1806 |
'default' => '#555555', // Updated default |
| 1807 |
'selectors' => [ |
| 1808 |
'{{WRAPPER}} .king-addons-pricing-slider__range-max' => 'color: {{VALUE}};', |
| 1809 |
], |
| 1810 |
] |
| 1811 |
); |
| 1812 |
|
| 1813 |
$this->add_group_control( |
| 1814 |
Group_Control_Typography::get_type(), |
| 1815 |
[ |
| 1816 |
'name' => 'max_label_typography', |
| 1817 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__range-max', |
| 1818 |
] |
| 1819 |
); |
| 1820 |
|
| 1821 |
$this->add_control( |
| 1822 |
'max_label_bg_color', |
| 1823 |
[ |
| 1824 |
'label' => esc_html__('Background Color', 'king-addons'), |
| 1825 |
'type' => Controls_Manager::COLOR, |
| 1826 |
'selectors' => [ |
| 1827 |
'{{WRAPPER}} .king-addons-pricing-slider__range-max' => 'background-color: {{VALUE}};', |
| 1828 |
], |
| 1829 |
] |
| 1830 |
); |
| 1831 |
|
| 1832 |
$this->add_responsive_control( |
| 1833 |
'max_label_padding', |
| 1834 |
[ |
| 1835 |
'label' => esc_html__('Padding', 'king-addons'), |
| 1836 |
'type' => Controls_Manager::DIMENSIONS, |
| 1837 |
'size_units' => ['px', 'em', '%'], |
| 1838 |
'selectors' => [ |
| 1839 |
'{{WRAPPER}} .king-addons-pricing-slider__range-max' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1840 |
], |
| 1841 |
] |
| 1842 |
); |
| 1843 |
|
| 1844 |
$this->add_group_control( |
| 1845 |
\Elementor\Group_Control_Border::get_type(), |
| 1846 |
[ |
| 1847 |
'name' => 'max_label_border', |
| 1848 |
'label' => esc_html__('Border', 'king-addons'), |
| 1849 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__range-max', |
| 1850 |
] |
| 1851 |
); |
| 1852 |
|
| 1853 |
$this->add_responsive_control( |
| 1854 |
'max_label_border_radius', |
| 1855 |
[ |
| 1856 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 1857 |
'type' => Controls_Manager::DIMENSIONS, |
| 1858 |
'size_units' => ['px', '%', 'em'], |
| 1859 |
'selectors' => [ |
| 1860 |
'{{WRAPPER}} .king-addons-pricing-slider__range-max' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1861 |
], |
| 1862 |
] |
| 1863 |
); |
| 1864 |
|
| 1865 |
$this->end_controls_section(); // End Section Range Labels Style |
| 1866 |
|
| 1867 |
// Call placeholder methods for Pro features |
| 1868 |
$this->add_control_slider_labels_styling(); |
| 1869 |
$this->add_control_advanced_formula_types(); |
| 1870 |
$this->add_control_multiple_sliders(); |
| 1871 |
$this->add_control_woocommerce_integration(); |
| 1872 |
$this->add_control_notifications_styling(); |
| 1873 |
|
| 1874 |
// Add Pro Features section |
| 1875 |
Core::renderProFeaturesSection( |
| 1876 |
$this, |
| 1877 |
'', |
| 1878 |
Controls_Manager::RAW_HTML, |
| 1879 |
'pricing-slider', |
| 1880 |
[ |
| 1881 |
esc_html__('Advanced Formula Types (Exponential, Logarithmic, etc.)', 'king-addons'), |
| 1882 |
esc_html__('Multiple Interactive Sliders', 'king-addons'), |
| 1883 |
esc_html__('WooCommerce Integration', 'king-addons'), |
| 1884 |
esc_html__('Multi-Currency Support', 'king-addons'), |
| 1885 |
esc_html__('Advanced Animation Effects', 'king-addons'), |
| 1886 |
esc_html__('Premium Templates Library', 'king-addons'), |
| 1887 |
] |
| 1888 |
); |
| 1889 |
} |
| 1890 |
|
| 1891 |
public function get_currency_symbol($symbol_name) |
| 1892 |
{ |
| 1893 |
$symbols = [ |
| 1894 |
'dollar' => '$', |
| 1895 |
'euro' => '€', |
| 1896 |
'pound' => '£', |
| 1897 |
'ruble' => '₽', |
| 1898 |
'shekel' => '₪', |
| 1899 |
'baht' => '฿', |
| 1900 |
'yen' => '¥', |
| 1901 |
'won' => '₩', |
| 1902 |
'rupee' => '₨', |
| 1903 |
'lira' => '₤', |
| 1904 |
'peseta' => '₧', |
| 1905 |
]; |
| 1906 |
|
| 1907 |
if (isset($symbols[$symbol_name])) { |
| 1908 |
return $symbols[$symbol_name]; |
| 1909 |
} |
| 1910 |
|
| 1911 |
return ''; |
| 1912 |
} |
| 1913 |
|
| 1914 |
public function calculate_price($value, $settings) |
| 1915 |
{ |
| 1916 |
if ($settings['price_formula'] === 'linear') { |
| 1917 |
// Linear formula: price = a * value + b |
| 1918 |
return $settings['formula_a'] * $value + $settings['formula_b']; |
| 1919 |
} else { |
| 1920 |
// Custom prices - find closest value or interpolate |
| 1921 |
$custom_prices = isset($settings['custom_prices']) && is_array($settings['custom_prices']) ? $settings['custom_prices'] : []; |
| 1922 |
|
| 1923 |
// Prevent usort() on null or non-array |
| 1924 |
if (empty($custom_prices)) { |
| 1925 |
return 0; |
| 1926 |
} |
| 1927 |
|
| 1928 |
// Sort by value |
| 1929 |
usort($custom_prices, function ($a, $b) { |
| 1930 |
return $a['value'] <=> $b['value']; |
| 1931 |
}); |
| 1932 |
|
| 1933 |
// Find exact match or closest values for interpolation |
| 1934 |
foreach ($custom_prices as $index => $price_point) { |
| 1935 |
if ($price_point['value'] == $value) { |
| 1936 |
// Exact match |
| 1937 |
return $price_point['price']; |
| 1938 |
} |
| 1939 |
|
| 1940 |
if ($index < count($custom_prices) - 1) { |
| 1941 |
$next_price_point = $custom_prices[$index + 1]; |
| 1942 |
|
| 1943 |
// If value is between this point and next point, interpolate |
| 1944 |
if ($value > $price_point['value'] && $value < $next_price_point['value']) { |
| 1945 |
// Linear interpolation |
| 1946 |
$ratio = ($value - $price_point['value']) / ($next_price_point['value'] - $price_point['value']); |
| 1947 |
return $price_point['price'] + $ratio * ($next_price_point['price'] - $price_point['price']); |
| 1948 |
} |
| 1949 |
} |
| 1950 |
} |
| 1951 |
|
| 1952 |
// If no match or interpolation, use first or last point |
| 1953 |
if ($value <= $custom_prices[0]['value']) { |
| 1954 |
return $custom_prices[0]['price']; |
| 1955 |
} else { |
| 1956 |
return end($custom_prices)['price']; |
| 1957 |
} |
| 1958 |
} |
| 1959 |
} |
| 1960 |
|
| 1961 |
public function is_feature_included($feature_min_value, $current_value) |
| 1962 |
{ |
| 1963 |
return $current_value >= $feature_min_value; |
| 1964 |
} |
| 1965 |
|
| 1966 |
/** |
| 1967 |
* Allow Pro to fully override widget output without using parent::render(). |
| 1968 |
* |
| 1969 |
* Pro can return true to indicate it rendered the widget output completely. |
| 1970 |
* |
| 1971 |
* @param array<string, mixed> $settings Widget settings for display. |
| 1972 |
* @return bool Whether Pro rendered output. |
| 1973 |
*/ |
| 1974 |
public function maybe_render_pro(array $settings): bool |
| 1975 |
{ |
| 1976 |
return false; |
| 1977 |
} |
| 1978 |
|
| 1979 |
public function render() |
| 1980 |
{ |
| 1981 |
$settings = $this->get_settings_for_display(); |
| 1982 |
|
| 1983 |
if ($this->maybe_render_pro($settings)) { |
| 1984 |
return; |
| 1985 |
} |
| 1986 |
|
| 1987 |
$default_value = isset($settings['default_value']) ? $settings['default_value'] : 50; |
| 1988 |
|
| 1989 |
// Ensure default value is within range |
| 1990 |
$default_value = max($settings['min_value'], min($settings['max_value'], $default_value)); |
| 1991 |
|
| 1992 |
// Calculate initial price |
| 1993 |
$initial_price = $this->calculate_price($default_value, $settings); |
| 1994 |
|
| 1995 |
// Get currency symbol |
| 1996 |
$currency_symbol = ''; |
| 1997 |
if (!empty($settings['currency_symbol'])) { |
| 1998 |
if ($settings['currency_symbol'] === 'custom') { |
| 1999 |
$currency_symbol = $settings['currency_symbol_custom']; |
| 2000 |
} else { |
| 2001 |
$currency_symbol = $this->get_currency_symbol($settings['currency_symbol']); |
| 2002 |
} |
| 2003 |
} |
| 2004 |
|
| 2005 |
// Format price (2 decimal places for cents) |
| 2006 |
$formatted_price = number_format($initial_price, 2); |
| 2007 |
|
| 2008 |
// Build price HTML |
| 2009 |
$price_html = ''; |
| 2010 |
if ($settings['currency_position'] === 'before') { |
| 2011 |
$price_html .= '<span class="king-addons-pricing-slider__currency">' . $currency_symbol . '</span>'; |
| 2012 |
} |
| 2013 |
|
| 2014 |
if (!empty($settings['price_prefix'])) { |
| 2015 |
$price_html .= '<span class="king-addons-pricing-slider__prefix">' . esc_html($settings['price_prefix']) . '</span>'; |
| 2016 |
} |
| 2017 |
|
| 2018 |
$price_html .= '<span class="king-addons-pricing-slider__price-value">' . $formatted_price . '</span>'; |
| 2019 |
|
| 2020 |
if (!empty($settings['price_suffix'])) { |
| 2021 |
$price_html .= '<span class="king-addons-pricing-slider__suffix">' . esc_html($settings['price_suffix']) . '</span>'; |
| 2022 |
} |
| 2023 |
|
| 2024 |
if ($settings['currency_position'] === 'after') { |
| 2025 |
$price_html .= '<span class="king-addons-pricing-slider__currency">' . $currency_symbol . '</span>'; |
| 2026 |
} |
| 2027 |
|
| 2028 |
if (!empty($settings['period'])) { |
| 2029 |
$price_html .= '<span class="king-addons-pricing-slider__period">' . esc_html($settings['period']) . '</span>'; |
| 2030 |
} |
| 2031 |
|
| 2032 |
// Generate unique ID for the slider |
| 2033 |
$slider_id = 'king-addons-pricing-slider-' . $this->get_id(); |
| 2034 |
|
| 2035 |
// Prepare JSON data for features |
| 2036 |
$features_data = []; |
| 2037 |
if ($settings['show_features'] === 'yes' && !empty($settings['feature_list'])) { |
| 2038 |
foreach ($settings['feature_list'] as $feature) { |
| 2039 |
$features_data[] = [ |
| 2040 |
'text' => $feature['feature_text'], |
| 2041 |
'min_value' => $feature['min_value_feature'], |
| 2042 |
'icon_included' => !empty($feature['feature_icon_included']['value']) ? $feature['feature_icon_included']['value'] : 'fas fa-check', |
| 2043 |
'icon_excluded' => !empty($feature['feature_icon_excluded']['value']) ? $feature['feature_icon_excluded']['value'] : 'fas fa-times', |
| 2044 |
]; |
| 2045 |
} |
| 2046 |
} |
| 2047 |
|
| 2048 |
// Prepare price data for JS |
| 2049 |
$price_data = [ |
| 2050 |
'formula' => $settings['price_formula'], |
| 2051 |
'a' => isset($settings['formula_a']) ? (float)$settings['formula_a'] : 1, |
| 2052 |
'b' => isset($settings['formula_b']) ? (float)$settings['formula_b'] : 0, |
| 2053 |
'custom_prices' => isset($settings['custom_prices']) ? $settings['custom_prices'] : [], |
| 2054 |
'currency_position' => $settings['currency_position'], |
| 2055 |
'currency_symbol' => $currency_symbol, |
| 2056 |
'price_prefix' => esc_html($settings['price_prefix']), |
| 2057 |
'price_suffix' => esc_html($settings['price_suffix']), |
| 2058 |
'period' => esc_html($settings['period']), |
| 2059 |
]; |
| 2060 |
|
| 2061 |
// Add Pro-version formula parameters if they exist |
| 2062 |
if (isset($settings['advanced_formula_types'])) { |
| 2063 |
$price_data['advanced_formula_types'] = $settings['advanced_formula_types']; |
| 2064 |
|
| 2065 |
// Add parameters for exponential formula |
| 2066 |
if (isset($settings['formula_exp_base'])) { |
| 2067 |
$price_data['formula_exp_base'] = (float)$settings['formula_exp_base']; |
| 2068 |
} |
| 2069 |
if (isset($settings['formula_exp_multiplier'])) { |
| 2070 |
$price_data['formula_exp_multiplier'] = (float)$settings['formula_exp_multiplier']; |
| 2071 |
} |
| 2072 |
|
| 2073 |
// Add parameters for logarithmic formula |
| 2074 |
if (isset($settings['formula_log_base'])) { |
| 2075 |
$price_data['formula_log_base'] = (float)$settings['formula_log_base']; |
| 2076 |
} |
| 2077 |
if (isset($settings['formula_log_multiplier'])) { |
| 2078 |
$price_data['formula_log_multiplier'] = (float)$settings['formula_log_multiplier']; |
| 2079 |
} |
| 2080 |
|
| 2081 |
// Add parameters for power formula |
| 2082 |
if (isset($settings['formula_power_exponent'])) { |
| 2083 |
$price_data['formula_power_exponent'] = (float)$settings['formula_power_exponent']; |
| 2084 |
} |
| 2085 |
if (isset($settings['formula_power_multiplier'])) { |
| 2086 |
$price_data['formula_power_multiplier'] = (float)$settings['formula_power_multiplier']; |
| 2087 |
} |
| 2088 |
} |
| 2089 |
|
| 2090 |
// Pass ONLY size settings as CSS variables |
| 2091 |
$this->add_render_attribute('_wrapper', 'class', 'king-addons-pricing-slider'); |
| 2092 |
$this->add_render_attribute( |
| 2093 |
'_wrapper', |
| 2094 |
'style', |
| 2095 |
sprintf( |
| 2096 |
'--slider-track-height: %1$spx; --slider-thumb-size: %2$spx;', |
| 2097 |
esc_attr($settings['slider_track_height']['size'] ?? '6'), |
| 2098 |
esc_attr($settings['slider_thumb_size']['size'] ?? '24') |
| 2099 |
) |
| 2100 |
); |
| 2101 |
|
| 2102 |
// Add class for shadow based on setting |
| 2103 |
if ($settings['slider_thumb_shadow'] === 'yes') { |
| 2104 |
$this->add_render_attribute('_wrapper', 'class', 'king-addons-slider-thumb-shadow-yes'); |
| 2105 |
} |
| 2106 |
|
| 2107 |
$this->add_render_attribute('_wrapper', 'data-features', json_encode($features_data)); |
| 2108 |
$this->add_render_attribute('_wrapper', 'data-price-data', json_encode($price_data)); |
| 2109 |
?> |
| 2110 |
<div <?php echo $this->get_render_attribute_string('_wrapper'); ?>> |
| 2111 |
<?php if (!empty($settings['title']) || !empty($settings['description'])) : ?> |
| 2112 |
<div class="king-addons-pricing-slider__header"> |
| 2113 |
<?php if (!empty($settings['title'])) : ?> |
| 2114 |
<h3 class="king-addons-pricing-slider__title"><?php echo esc_html($settings['title']); ?></h3> |
| 2115 |
<?php endif; ?> |
| 2116 |
<?php if (!empty($settings['description'])) : ?> |
| 2117 |
<div class="king-addons-pricing-slider__description"><?php echo wp_kses_post($settings['description']); ?></div> |
| 2118 |
<?php endif; ?> |
| 2119 |
</div> |
| 2120 |
<?php endif; ?> |
| 2121 |
|
| 2122 |
<div class="king-addons-pricing-slider__controls"> |
| 2123 |
<div class="king-addons-pricing-slider__control-group"> |
| 2124 |
<?php if ($settings['min_label'] || $settings['max_label']) : ?> |
| 2125 |
<div class="king-addons-pricing-slider__range-labels"> |
| 2126 |
<span class="king-addons-pricing-slider__range-min"><?php echo esc_html($settings['min_label']); ?></span> |
| 2127 |
<span class="king-addons-pricing-slider__range-max"><?php echo esc_html($settings['max_label']); ?></span> |
| 2128 |
</div> |
| 2129 |
<?php endif; ?> |
| 2130 |
|
| 2131 |
<div class="king-addons-pricing-slider__range-container"> |
| 2132 |
<div class="king-addons-pricing-slider__track"></div> |
| 2133 |
<div class="king-addons-pricing-slider__progress"></div> |
| 2134 |
<div class="king-addons-pricing-slider__custom-thumb"></div> |
| 2135 |
<?php if ('yes' === $settings['show_current_value_indicator']) : ?> |
| 2136 |
<span class="king-addons-pricing-slider__current-value"><?php echo esc_html($default_value); ?></span> |
| 2137 |
<?php endif; ?> |
| 2138 |
<input type="range" class="king-addons-pricing-slider__range" |
| 2139 |
min="<?php echo esc_attr($settings['min_value']); ?>" |
| 2140 |
max="<?php echo esc_attr($settings['max_value']); ?>" |
| 2141 |
step="<?php echo esc_attr($settings['step']); ?>" |
| 2142 |
value="<?php echo esc_attr($default_value); ?>" |
| 2143 |
aria-labelledby="king-addons-pricing-slider-label"> |
| 2144 |
</div> |
| 2145 |
|
| 2146 |
<div class="king-addons-pricing-slider__range-values"> |
| 2147 |
<span class="king-addons-pricing-slider__range-min-value"><?php echo esc_html($settings['min_value']); ?></span> |
| 2148 |
<span class="king-addons-pricing-slider__range-max-value"><?php echo esc_html($settings['max_value']); ?></span> |
| 2149 |
</div> |
| 2150 |
</div> |
| 2151 |
</div> |
| 2152 |
|
| 2153 |
<div class="king-addons-pricing-slider__display"> |
| 2154 |
<div class="king-addons-pricing-slider__price"><?php echo $price_html; ?></div> |
| 2155 |
</div> |
| 2156 |
|
| 2157 |
<?php if ($settings['show_features'] === 'yes' && !empty($settings['feature_list'])) : ?> |
| 2158 |
<div class="king-addons-pricing-slider__features"> |
| 2159 |
<ul class="king-addons-pricing-slider__feature-list"> |
| 2160 |
<?php foreach ($settings['feature_list'] as $feature) : |
| 2161 |
$is_included = $this->is_feature_included($feature['min_value_feature'], $default_value); |
| 2162 |
$icon_class = $is_included ? 'king-addons-pricing-slider__feature-included' : 'king-addons-pricing-slider__feature-excluded'; |
| 2163 |
$icon = $is_included ? $feature['feature_icon_included'] : $feature['feature_icon_excluded']; |
| 2164 |
$li_class = $is_included ? 'king-addons-feature-included' : 'king-addons-feature-excluded'; |
| 2165 |
?> |
| 2166 |
<li class="king-addons-pricing-slider__feature-item <?php echo esc_attr($li_class); ?>" data-min-value="<?php echo esc_attr($feature['min_value_feature']); ?>"> |
| 2167 |
<span class="<?php echo esc_attr($icon_class); ?>"> |
| 2168 |
<?php \Elementor\Icons_Manager::render_icon($icon, ['aria-hidden' => 'true']); ?> |
| 2169 |
</span> |
| 2170 |
<span class="king-addons-pricing-slider__feature-text"><?php echo esc_html($feature['feature_text']); ?></span> |
| 2171 |
</li> |
| 2172 |
<?php endforeach; ?> |
| 2173 |
</ul> |
| 2174 |
</div> |
| 2175 |
<?php endif; ?> |
| 2176 |
|
| 2177 |
<?php if ($settings['show_button'] === 'yes') : ?> |
| 2178 |
<div class="king-addons-pricing-slider__actions"> |
| 2179 |
<a href="<?php echo esc_url($settings['button_url']['url']); ?>" class="king-addons-pricing-slider__button elementor-animation-<?php echo esc_attr($settings['button_hover_animation']); ?>" |
| 2180 |
<?php echo !empty($settings['button_url']['is_external']) ? ' target="_blank"' : ''; ?> |
| 2181 |
<?php echo !empty($settings['button_url']['nofollow']) ? ' rel="nofollow"' : ''; ?>> |
| 2182 |
<?php echo esc_html($settings['button_text']); ?> |
| 2183 |
</a> |
| 2184 |
</div> |
| 2185 |
<?php endif; ?> |
| 2186 |
</div> |
| 2187 |
<?php |
| 2188 |
} |
| 2189 |
|
| 2190 |
public function add_control_advanced_formula_types() |
| 2191 |
{ |
| 2192 |
// Empty placeholder for Pro feature |
| 2193 |
$this->start_controls_section( |
| 2194 |
'advanced_formula_types_placeholder', |
| 2195 |
[ |
| 2196 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Advanced Formula Types', 'king-addons'), |
| 2197 |
] |
| 2198 |
); |
| 2199 |
|
| 2200 |
$this->add_control( |
| 2201 |
'advanced_formula_types_notice', |
| 2202 |
[ |
| 2203 |
'type' => Controls_Manager::RAW_HTML, |
| 2204 |
'raw' => 'Advanced Formula Types are available in the ' . |
| 2205 |
'<strong><a href="https://kingaddons.com/pricing/?utm_source=kng-module-pricing-slider-settings-upgrade-pro&utm_medium=plugin&utm_campaign=kng" target="_blank">Pro version</a></strong>', |
| 2206 |
'content_classes' => 'king-addons-pro-notice', |
| 2207 |
] |
| 2208 |
); |
| 2209 |
|
| 2210 |
$this->end_controls_section(); |
| 2211 |
} |
| 2212 |
|
| 2213 |
/** |
| 2214 |
* Pro feature - Multiple sliders |
| 2215 |
*/ |
| 2216 |
public function add_control_multiple_sliders() |
| 2217 |
{ |
| 2218 |
|
| 2219 |
$this->start_controls_section( |
| 2220 |
'section_multiple_sliders_placeholder', |
| 2221 |
[ |
| 2222 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Multiple Sliders', 'king-addons'), |
| 2223 |
] |
| 2224 |
); |
| 2225 |
|
| 2226 |
$this->add_control( |
| 2227 |
'multiple_sliders_notice', |
| 2228 |
[ |
| 2229 |
'type' => Controls_Manager::RAW_HTML, |
| 2230 |
'raw' => 'Multiple interactive sliders with combined price calculation are available in the ' . |
| 2231 |
'<strong><a href="https://kingaddons.com/pricing/?utm_source=kng-module-pricing-slider-settings-upgrade-pro&utm_medium=plugin&utm_campaign=kng" target="_blank">Pro version</a></strong>', |
| 2232 |
'content_classes' => 'king-addons-pro-notice', |
| 2233 |
] |
| 2234 |
); |
| 2235 |
|
| 2236 |
|
| 2237 |
|
| 2238 |
|
| 2239 |
$this->end_controls_section(); |
| 2240 |
|
| 2241 |
|
| 2242 |
} |
| 2243 |
|
| 2244 |
public function add_control_woocommerce_integration() |
| 2245 |
{ |
| 2246 |
// Section for WooCommerce Placeholder in Free version |
| 2247 |
$this->start_controls_section( |
| 2248 |
'section_woocommerce_placeholder', |
| 2249 |
[ |
| 2250 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('WooCommerce', 'king-addons'), |
| 2251 |
] |
| 2252 |
); |
| 2253 |
|
| 2254 |
$this->add_control( |
| 2255 |
'woocommerce_integration_notice', |
| 2256 |
[ |
| 2257 |
'type' => Controls_Manager::RAW_HTML, |
| 2258 |
'raw' => 'WooCommerce integration with dynamic pricing and automatic cart functionality is available in the ' . |
| 2259 |
'<strong><a href="https://kingaddons.com/pricing/?utm_source=kng-module-pricing-slider-settings-upgrade-pro&utm_medium=plugin&utm_campaign=kng" target="_blank">Pro version</a></strong>', |
| 2260 |
'content_classes' => 'king-addons-pro-notice', |
| 2261 |
] |
| 2262 |
); |
| 2263 |
|
| 2264 |
$this->end_controls_section(); // End of section_woocommerce_placeholder |
| 2265 |
} |
| 2266 |
|
| 2267 |
/** |
| 2268 |
* Adds controls for slider label styling |
| 2269 |
*/ |
| 2270 |
public function add_control_slider_labels_styling() |
| 2271 |
{ |
| 2272 |
$this->start_controls_section( |
| 2273 |
'section_slider_labels_style', |
| 2274 |
[ |
| 2275 |
'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Slider Labels', 'king-addons'), |
| 2276 |
'tab' => Controls_Manager::TAB_STYLE, |
| 2277 |
] |
| 2278 |
); |
| 2279 |
|
| 2280 |
$this->add_control( |
| 2281 |
'slider_label_style_heading', |
| 2282 |
[ |
| 2283 |
'label' => esc_html__('Slider Label Style', 'king-addons'), |
| 2284 |
'type' => Controls_Manager::HEADING, |
| 2285 |
] |
| 2286 |
); |
| 2287 |
|
| 2288 |
$this->add_control( |
| 2289 |
'slider_label_text_color', |
| 2290 |
[ |
| 2291 |
'label' => esc_html__('Text Color', 'king-addons'), |
| 2292 |
'type' => Controls_Manager::COLOR, |
| 2293 |
'default' => '#333333', |
| 2294 |
'selectors' => [ |
| 2295 |
'{{WRAPPER}} .king-addons-pricing-slider__control-label' => 'color: {{VALUE}};', |
| 2296 |
], |
| 2297 |
] |
| 2298 |
); |
| 2299 |
|
| 2300 |
$this->add_group_control( |
| 2301 |
Group_Control_Typography::get_type(), |
| 2302 |
[ |
| 2303 |
'name' => 'slider_label_typography', |
| 2304 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__control-label', |
| 2305 |
'fields_options' => [ |
| 2306 |
'font_weight' => ['default' => '600'], |
| 2307 |
'font_size' => ['default' => ['unit' => 'px', 'size' => 16]], |
| 2308 |
], |
| 2309 |
] |
| 2310 |
); |
| 2311 |
|
| 2312 |
$this->add_control( |
| 2313 |
'slider_label_bg_color', |
| 2314 |
[ |
| 2315 |
'label' => esc_html__('Background Color', 'king-addons'), |
| 2316 |
'type' => Controls_Manager::COLOR, |
| 2317 |
'selectors' => [ |
| 2318 |
'{{WRAPPER}} .king-addons-pricing-slider__control-label' => 'background-color: {{VALUE}};', |
| 2319 |
], |
| 2320 |
] |
| 2321 |
); |
| 2322 |
|
| 2323 |
$this->add_responsive_control( |
| 2324 |
'slider_label_padding', |
| 2325 |
[ |
| 2326 |
'label' => esc_html__('Padding', 'king-addons'), |
| 2327 |
'type' => Controls_Manager::DIMENSIONS, |
| 2328 |
'size_units' => ['px', 'em', '%'], |
| 2329 |
'default' => [ |
| 2330 |
'top' => '0', |
| 2331 |
'right' => '0', |
| 2332 |
'bottom' => '5', |
| 2333 |
'left' => '0', |
| 2334 |
'unit' => 'px', |
| 2335 |
'isLinked' => false, |
| 2336 |
], |
| 2337 |
'selectors' => [ |
| 2338 |
'{{WRAPPER}} .king-addons-pricing-slider__control-label' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2339 |
], |
| 2340 |
] |
| 2341 |
); |
| 2342 |
|
| 2343 |
$this->add_responsive_control( |
| 2344 |
'slider_label_margin', |
| 2345 |
[ |
| 2346 |
'label' => esc_html__('Margin', 'king-addons'), |
| 2347 |
'type' => Controls_Manager::DIMENSIONS, |
| 2348 |
'size_units' => ['px', 'em', '%'], |
| 2349 |
'default' => [ |
| 2350 |
'top' => '0', |
| 2351 |
'right' => '0', |
| 2352 |
'bottom' => '5', |
| 2353 |
'left' => '0', |
| 2354 |
'unit' => 'px', |
| 2355 |
'isLinked' => false, |
| 2356 |
], |
| 2357 |
'selectors' => [ |
| 2358 |
'{{WRAPPER}} .king-addons-pricing-slider__control-label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2359 |
], |
| 2360 |
] |
| 2361 |
); |
| 2362 |
|
| 2363 |
$this->add_group_control( |
| 2364 |
\Elementor\Group_Control_Border::get_type(), |
| 2365 |
[ |
| 2366 |
'name' => 'slider_label_border', |
| 2367 |
'label' => esc_html__('Border', 'king-addons'), |
| 2368 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__control-label', |
| 2369 |
] |
| 2370 |
); |
| 2371 |
|
| 2372 |
$this->add_responsive_control( |
| 2373 |
'slider_label_border_radius', |
| 2374 |
[ |
| 2375 |
'label' => esc_html__('Border Radius', 'king-addons'), |
| 2376 |
'type' => Controls_Manager::DIMENSIONS, |
| 2377 |
'size_units' => ['px', '%', 'em'], |
| 2378 |
'selectors' => [ |
| 2379 |
'{{WRAPPER}} .king-addons-pricing-slider__control-label' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2380 |
], |
| 2381 |
] |
| 2382 |
); |
| 2383 |
|
| 2384 |
$this->add_control( |
| 2385 |
'slider_label_text_align', |
| 2386 |
[ |
| 2387 |
'label' => esc_html__('Text Alignment', 'king-addons'), |
| 2388 |
'type' => Controls_Manager::CHOOSE, |
| 2389 |
'options' => [ |
| 2390 |
'left' => [ |
| 2391 |
'title' => esc_html__('Left', 'king-addons'), |
| 2392 |
'icon' => 'eicon-text-align-left', |
| 2393 |
], |
| 2394 |
'center' => [ |
| 2395 |
'title' => esc_html__('Center', 'king-addons'), |
| 2396 |
'icon' => 'eicon-text-align-center', |
| 2397 |
], |
| 2398 |
'right' => [ |
| 2399 |
'title' => esc_html__('Right', 'king-addons'), |
| 2400 |
'icon' => 'eicon-text-align-right', |
| 2401 |
], |
| 2402 |
], |
| 2403 |
'default' => 'left', |
| 2404 |
'selectors' => [ |
| 2405 |
'{{WRAPPER}} .king-addons-pricing-slider__control-label' => 'text-align: {{VALUE}};', |
| 2406 |
], |
| 2407 |
] |
| 2408 |
); |
| 2409 |
|
| 2410 |
$this->add_group_control( |
| 2411 |
\Elementor\Group_Control_Text_Shadow::get_type(), |
| 2412 |
[ |
| 2413 |
'name' => 'slider_label_text_shadow', |
| 2414 |
'selector' => '{{WRAPPER}} .king-addons-pricing-slider__control-label', |
| 2415 |
] |
| 2416 |
); |
| 2417 |
|
| 2418 |
$this->end_controls_section(); |
| 2419 |
} |
| 2420 |
|
| 2421 |
public function add_control_notifications_styling() |
| 2422 |
{ |
| 2423 |
// Empty placeholder for Pro feature |
| 2424 |
} |
| 2425 |
} |
| 2426 |
|