| @@ -1,0 +1,822 @@ | ||
| 1 | +<?php /** @noinspection SpellCheckingInspection, DuplicatedCode, PhpUnused */ | |
| 2 | + | |
| 3 | +namespace King_Addons; | |
| 4 | + | |
| 5 | +use Elementor\Controls_Manager; | |
| 6 | +use Elementor\Group_Control_Border; | |
| 7 | +use Elementor\Group_Control_Box_Shadow; | |
| 8 | +use Elementor\Group_Control_Css_Filter; | |
| 9 | +use Elementor\Group_Control_Image_Size; | |
| 10 | +use Elementor\Group_Control_Typography; | |
| 11 | +use Elementor\Repeater; | |
| 12 | +use Elementor\Utils; | |
| 13 | +use Elementor\Widget_Base; | |
| 14 | + | |
| 15 | +if (!defined('ABSPATH')) { | |
| 16 | + exit; // Exit if accessed directly. | |
| 17 | +} | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | +class Price_List extends Widget_Base | |
| 22 | +{ | |
| 23 | + | |
| 24 | + | |
| 25 | + public function get_name(): string | |
| 26 | + { | |
| 27 | + return 'king-addons-price-list'; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public function get_title(): string | |
| 31 | + { | |
| 32 | + return esc_html__('Price List & Menu', 'king-addons'); | |
| 33 | + } | |
| 34 | + | |
| 35 | + public function get_icon(): string | |
| 36 | + { | |
| 37 | + return 'king-addons-icon king-addons-price-list'; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public function get_style_depends(): array | |
| 41 | + { | |
| 42 | + return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-price-list-style']; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public function get_categories(): array | |
| 46 | + { | |
| 47 | + return ['king-addons']; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public function get_keywords(): array | |
| 51 | + { | |
| 52 | + return ['rows', 'kingaddons', 'king-addons', 'king', 'addons', 'business price', 'opening', 'working', 'office', | |
| 53 | + 'store', 'price of operation', 'schedule', 'time', 'availability', 'service', 'services', 'operating', 'shop', | |
| 54 | + 'list', 'business', 'price', 'times', 'operation', 'list', 'title', 'titles', 'description', 'row', 'column', | |
| 55 | + 'prices', 'columns', 'pricing', 'menu', 'store', 'cafe', 'restaurant', 'coffee', 'lunch', 'dish', 'dishes', | |
| 56 | + 'kitchen', 'cook', 'cooking', 'order', 'book', 'rate', 'sheet', 'catalog', 'guide', 'chart', 'schedule', | |
| 57 | + 'cost', 'food', 'bill', 'dining', 'options', 'option', 'fare', 'meal', 'selection', 'board', 'fee', 'tax', | |
| 58 | + 'income', 'review', 'taxes' | |
| 59 | + ]; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public function get_custom_help_url() | |
| 63 | + { | |
| 64 | + return 'mailto:[email protected]?subject=Bug Report - King Addons&body=Please describe the issue'; | |
| 65 | + } | |
| 66 | + | |
| 67 | + protected function register_controls(): void | |
| 68 | + { | |
| 69 | + | |
| 70 | + /** CONTENT SECTION: List Settings ===================== */ | |
| 71 | + $this->start_controls_section( | |
| 72 | + 'kng_price_list_content_section_list_settings', | |
| 73 | + [ | |
| 74 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('List Settings', 'king-addons'), | |
| 75 | + 'tab' => Controls_Manager::TAB_CONTENT, | |
| 76 | + ] | |
| 77 | + ); | |
| 78 | + | |
| 79 | + $this->add_control( | |
| 80 | + 'kng_price_list_image_disable_image_swithcer', | |
| 81 | + [ | |
| 82 | + 'label' => esc_html__('Disable Image', 'king-addons'), | |
| 83 | + 'type' => Controls_Manager::SWITCHER, | |
| 84 | + ] | |
| 85 | + ); | |
| 86 | + | |
| 87 | + $this->end_controls_section(); | |
| 88 | + /** END CONTENT SECTION: List Settings ===================== */ | |
| 89 | + | |
| 90 | + /** CONTENT SECTION: Items ===================== */ | |
| 91 | + $this->start_controls_section( | |
| 92 | + 'kng_price_list_content_section_items', | |
| 93 | + [ | |
| 94 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Items', 'king-addons'), | |
| 95 | + 'tab' => Controls_Manager::TAB_CONTENT, | |
| 96 | + ] | |
| 97 | + ); | |
| 98 | + | |
| 99 | + $repeater = new Repeater(); | |
| 100 | + | |
| 101 | + $repeater->add_control( | |
| 102 | + 'kng_price_list_image', | |
| 103 | + [ | |
| 104 | + 'label' => esc_html__('Image', 'king-addons'), | |
| 105 | + 'type' => Controls_Manager::MEDIA, | |
| 106 | + 'default' => [ | |
| 107 | + 'url' => Utils::get_placeholder_image_src(), | |
| 108 | + ] | |
| 109 | + ] | |
| 110 | + ); | |
| 111 | + | |
| 112 | + $repeater->add_group_control( | |
| 113 | + Group_Control_Image_Size::get_type(), | |
| 114 | + [ | |
| 115 | + 'name' => 'kng_price_list_image_size', | |
| 116 | + 'default' => 'full' | |
| 117 | + ] | |
| 118 | + ); | |
| 119 | + | |
| 120 | + $repeater->add_control( | |
| 121 | + 'kng_price_list_title', | |
| 122 | + [ | |
| 123 | + 'label' => esc_html__('Title', 'king-addons'), | |
| 124 | + 'default' => esc_html__('Title', 'king-addons'), | |
| 125 | + 'type' => Controls_Manager::TEXT, | |
| 126 | + 'label_block' => true, | |
| 127 | + ] | |
| 128 | + ); | |
| 129 | + | |
| 130 | + $repeater->add_control( | |
| 131 | + 'kng_price_list_description', | |
| 132 | + [ | |
| 133 | + 'label' => esc_html__('Description', 'king-addons'), | |
| 134 | + 'default' => esc_html__('Description', 'king-addons'), | |
| 135 | + 'type' => Controls_Manager::TEXT, | |
| 136 | + 'label_block' => true, | |
| 137 | + ] | |
| 138 | + ); | |
| 139 | + | |
| 140 | + $repeater->add_control( | |
| 141 | + 'kng_price_list_price', | |
| 142 | + [ | |
| 143 | + 'label' => esc_html__('Price', 'king-addons'), | |
| 144 | + 'default' => esc_html__('Price', 'king-addons'), | |
| 145 | + 'type' => Controls_Manager::TEXT, | |
| 146 | + 'label_block' => true, | |
| 147 | + ] | |
| 148 | + ); | |
| 149 | + | |
| 150 | + $this->add_control( | |
| 151 | + 'kng_price_list_content_items', | |
| 152 | + [ | |
| 153 | + 'type' => Controls_Manager::REPEATER, | |
| 154 | + 'fields' => $repeater->get_controls(), | |
| 155 | + 'default' => [ | |
| 156 | + [ | |
| 157 | + 'kng_price_list_image' => Utils::get_placeholder_image_src(), | |
| 158 | + 'kng_price_list_title' => esc_html__('English Breakfast', 'king-addons'), | |
| 159 | + 'kng_price_list_description' => esc_html__('Lorem ipsum dolor', 'king-addons'), | |
| 160 | + 'kng_price_list_price' => esc_html__('$18', 'king-addons'), | |
| 161 | + ], | |
| 162 | + [ | |
| 163 | + 'kng_price_list_image' => Utils::get_placeholder_image_src(), | |
| 164 | + 'kng_price_list_title' => esc_html__('Italian Pasta', 'king-addons'), | |
| 165 | + 'kng_price_list_description' => esc_html__('Lorem ipsum dolor', 'king-addons'), | |
| 166 | + 'kng_price_list_price' => esc_html__('$25', 'king-addons'), | |
| 167 | + ], | |
| 168 | + [ | |
| 169 | + 'kng_price_list_image' => Utils::get_placeholder_image_src(), | |
| 170 | + 'kng_price_list_title' => esc_html__('Sandwich', 'king-addons'), | |
| 171 | + 'kng_price_list_description' => esc_html__('Lorem ipsum dolor', 'king-addons'), | |
| 172 | + 'kng_price_list_price' => esc_html__('$13', 'king-addons'), | |
| 173 | + ], | |
| 174 | + [ | |
| 175 | + 'kng_price_list_image' => Utils::get_placeholder_image_src(), | |
| 176 | + 'kng_price_list_title' => esc_html__('Spring Salad', 'king-addons'), | |
| 177 | + 'kng_price_list_description' => esc_html__('Lorem ipsum dolor', 'king-addons'), | |
| 178 | + 'kng_price_list_price' => esc_html__('$14', 'king-addons'), | |
| 179 | + ], | |
| 180 | + ], | |
| 181 | + 'title_field' => '{{kng_price_list_title}}', | |
| 182 | + ] | |
| 183 | + ); | |
| 184 | + | |
| 185 | + $this->end_controls_section(); | |
| 186 | + /** END CONTENT SECTION: Items ===================== */ | |
| 187 | + | |
| 188 | + /** STYLE SECTION: Items ===================== */ | |
| 189 | + $this->start_controls_section( | |
| 190 | + 'kng_price_list_style_section_items', | |
| 191 | + [ | |
| 192 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Items', 'king-addons'), | |
| 193 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 194 | + ] | |
| 195 | + ); | |
| 196 | + | |
| 197 | + $this->add_group_control( | |
| 198 | + Group_Control_Typography::get_type(), | |
| 199 | + [ | |
| 200 | + 'label' => esc_html__('Title Typography', 'king-addons'), | |
| 201 | + 'name' => 'kng_price_list_typography_title', | |
| 202 | + 'fields_options' => [ | |
| 203 | + 'font_size' => [ | |
| 204 | + 'default' => [ | |
| 205 | + 'size' => 20, | |
| 206 | + 'unit' => 'px' | |
| 207 | + ], | |
| 208 | + ], | |
| 209 | + 'font_weight' => [ | |
| 210 | + 'default' => 600, | |
| 211 | + ], | |
| 212 | + 'typography' => [ | |
| 213 | + 'default' => 'custom', | |
| 214 | + ] | |
| 215 | + ], | |
| 216 | + 'selector' => '{{WRAPPER}} .king-addons-price-list-item-title', | |
| 217 | + ] | |
| 218 | + ); | |
| 219 | + | |
| 220 | + $this->add_control( | |
| 221 | + 'kng_price_list_color_title', | |
| 222 | + [ | |
| 223 | + 'label' => esc_html__('Title Color', 'king-addons'), | |
| 224 | + 'type' => Controls_Manager::COLOR, | |
| 225 | + 'default' => '#1E1E1E', | |
| 226 | + 'selectors' => [ | |
| 227 | + '{{WRAPPER}} .king-addons-price-list-item-title' => 'color: {{VALUE}};', | |
| 228 | + ], | |
| 229 | + ] | |
| 230 | + ); | |
| 231 | + | |
| 232 | + $this->add_group_control( | |
| 233 | + Group_Control_Typography::get_type(), | |
| 234 | + [ | |
| 235 | + 'label' => esc_html__('Description Typography', 'king-addons'), | |
| 236 | + 'name' => 'kng_price_list_typography_description', | |
| 237 | + 'fields_options' => [ | |
| 238 | + 'font_size' => [ | |
| 239 | + 'default' => [ | |
| 240 | + 'size' => 17, | |
| 241 | + 'unit' => 'px' | |
| 242 | + ], | |
| 243 | + ], | |
| 244 | + 'typography' => [ | |
| 245 | + 'default' => 'custom', | |
| 246 | + ] | |
| 247 | + ], | |
| 248 | + 'selector' => '{{WRAPPER}} .king-addons-price-list-item-description', | |
| 249 | + ] | |
| 250 | + ); | |
| 251 | + | |
| 252 | + $this->add_control( | |
| 253 | + 'kng_price_list_color_description', | |
| 254 | + [ | |
| 255 | + 'label' => esc_html__('Description Color', 'king-addons'), | |
| 256 | + 'type' => Controls_Manager::COLOR, | |
| 257 | + 'default' => '#1E1E1E', | |
| 258 | + 'selectors' => [ | |
| 259 | + '{{WRAPPER}} .king-addons-price-list-item-description' => 'color: {{VALUE}};', | |
| 260 | + ], | |
| 261 | + ] | |
| 262 | + ); | |
| 263 | + | |
| 264 | + $this->add_group_control( | |
| 265 | + Group_Control_Typography::get_type(), | |
| 266 | + [ | |
| 267 | + 'label' => esc_html__('Price Typography', 'king-addons'), | |
| 268 | + 'name' => 'kng_price_list_typography_price', | |
| 269 | + 'fields_options' => [ | |
| 270 | + 'font_size' => [ | |
| 271 | + 'default' => [ | |
| 272 | + 'size' => 20, | |
| 273 | + 'unit' => 'px' | |
| 274 | + ], | |
| 275 | + ], | |
| 276 | + 'font_weight' => [ | |
| 277 | + 'default' => 600, | |
| 278 | + ], | |
| 279 | + 'typography' => [ | |
| 280 | + 'default' => 'custom', | |
| 281 | + ] | |
| 282 | + ], | |
| 283 | + 'selector' => '{{WRAPPER}} .king-addons-price-list-item-price', | |
| 284 | + ] | |
| 285 | + ); | |
| 286 | + | |
| 287 | + $this->add_control( | |
| 288 | + 'kng_price_list_color_price', | |
| 289 | + [ | |
| 290 | + 'label' => esc_html__('Price Color', 'king-addons'), | |
| 291 | + 'type' => Controls_Manager::COLOR, | |
| 292 | + 'default' => '#1E1E1E', | |
| 293 | + 'selectors' => [ | |
| 294 | + '{{WRAPPER}} .king-addons-price-list-item-price' => 'color: {{VALUE}};', | |
| 295 | + ], | |
| 296 | + ] | |
| 297 | + ); | |
| 298 | + | |
| 299 | + $this->add_responsive_control( | |
| 300 | + 'kng_price_list_space_between_items', | |
| 301 | + [ | |
| 302 | + 'label' => esc_html__('Space between items (px)', 'king-addons'), | |
| 303 | + 'type' => Controls_Manager::NUMBER, | |
| 304 | + 'min' => 0, | |
| 305 | + 'default' => 30, | |
| 306 | + 'step' => 1, | |
| 307 | + 'selectors' => [ | |
| 308 | + '{{WRAPPER}} .king-addons-price-list-item' => 'padding-top: calc({{SIZE}}px / 2); padding-bottom: calc({{SIZE}}px / 2);', | |
| 309 | + ], | |
| 310 | + ] | |
| 311 | + ); | |
| 312 | + | |
| 313 | + $this->add_control( | |
| 314 | + 'kng_price_list_vertical_align', | |
| 315 | + [ | |
| 316 | + 'label' => esc_html__('Vertical Align', 'king-addons'), | |
| 317 | + 'type' => Controls_Manager::SELECT, | |
| 318 | + 'options' => [ | |
| 319 | + 'start' => esc_html__('Start', 'king-addons'), | |
| 320 | + 'center' => esc_html__('Center', 'king-addons'), | |
| 321 | + 'end' => esc_html__('End', 'king-addons'), | |
| 322 | + ], | |
| 323 | + 'default' => 'center', | |
| 324 | + 'selectors' => [ | |
| 325 | + '{{WRAPPER}} .king-addons-price-list-item' => 'align-items: {{VALUE}};', | |
| 326 | + ], | |
| 327 | + ] | |
| 328 | + ); | |
| 329 | + | |
| 330 | + $this->end_controls_section(); | |
| 331 | + /** END STYLE SECTION: Items ===================== */ | |
| 332 | + | |
| 333 | + /** STYLE SECTION: Lines ===================== */ | |
| 334 | + $this->start_controls_section( | |
| 335 | + 'kng_card_carousel_style_section_lines', | |
| 336 | + [ | |
| 337 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Lines', 'king-addons'), | |
| 338 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 339 | + ] | |
| 340 | + ); | |
| 341 | + | |
| 342 | + $this->add_control( | |
| 343 | + 'kng_price_list_line_heading_1', | |
| 344 | + [ | |
| 345 | + 'label' => esc_html__('Title --- Price', 'king-addons'), | |
| 346 | + 'type' => Controls_Manager::HEADING, | |
| 347 | + ] | |
| 348 | + ); | |
| 349 | + | |
| 350 | + $this->add_control( | |
| 351 | + 'kng_price_list_line_type', | |
| 352 | + [ | |
| 353 | + 'label' => esc_html__('Line Type', 'king-addons'), | |
| 354 | + 'type' => Controls_Manager::SELECT, | |
| 355 | + 'options' => [ | |
| 356 | + 'none' => esc_html__('None', 'king-addons'), | |
| 357 | + 'solid' => esc_html__('Solid', 'king-addons'), | |
| 358 | + 'dotted' => esc_html__('Dotted', 'king-addons'), | |
| 359 | + 'dashed' => esc_html__('Dashed', 'king-addons'), | |
| 360 | + ], | |
| 361 | + 'default' => 'solid', | |
| 362 | + 'selectors' => [ | |
| 363 | + '{{WRAPPER}} .king-addons-price-list-item-line' => 'border-bottom-style: {{VALUE}};', | |
| 364 | + ], | |
| 365 | + ] | |
| 366 | + ); | |
| 367 | + | |
| 368 | + $this->add_control( | |
| 369 | + 'kng_price_list_line_color', | |
| 370 | + [ | |
| 371 | + 'label' => esc_html__('Line Color', 'king-addons'), | |
| 372 | + 'type' => Controls_Manager::COLOR, | |
| 373 | + 'default' => '#1E1E1E33', | |
| 374 | + 'selectors' => [ | |
| 375 | + '{{WRAPPER}} .king-addons-price-list-item-line' => 'border-bottom-color: {{VALUE}};', | |
| 376 | + ], | |
| 377 | + ] | |
| 378 | + ); | |
| 379 | + | |
| 380 | + $this->add_control( | |
| 381 | + 'kng_price_list_line_width', | |
| 382 | + [ | |
| 383 | + 'label' => esc_html__('Line Width', 'king-addons'), | |
| 384 | + 'type' => Controls_Manager::NUMBER, | |
| 385 | + 'min' => 0, | |
| 386 | + 'default' => 1, | |
| 387 | + 'step' => 1, | |
| 388 | + 'selectors' => [ | |
| 389 | + '{{WRAPPER}} .king-addons-price-list-item-line' => 'border-bottom-width: {{SIZE}}px;', | |
| 390 | + ], | |
| 391 | + ] | |
| 392 | + ); | |
| 393 | + | |
| 394 | + $this->add_control( | |
| 395 | + 'kng_price_list_line_heading_2', | |
| 396 | + [ | |
| 397 | + 'label' => esc_html__('Under Title', 'king-addons'), | |
| 398 | + 'type' => Controls_Manager::HEADING, | |
| 399 | + 'separator' => 'before', | |
| 400 | + ] | |
| 401 | + ); | |
| 402 | + | |
| 403 | + $this->add_control( | |
| 404 | + 'kng_price_list_line_type_under', | |
| 405 | + [ | |
| 406 | + 'label' => esc_html__('Line Type', 'king-addons'), | |
| 407 | + 'type' => Controls_Manager::SELECT, | |
| 408 | + 'options' => [ | |
| 409 | + 'none' => esc_html__('None', 'king-addons'), | |
| 410 | + 'solid' => esc_html__('Solid', 'king-addons'), | |
| 411 | + 'dotted' => esc_html__('Dotted', 'king-addons'), | |
| 412 | + 'dashed' => esc_html__('Dashed', 'king-addons'), | |
| 413 | + ], | |
| 414 | + 'default' => 'none', | |
| 415 | + 'selectors' => [ | |
| 416 | + '{{WRAPPER}} .king-addons-price-list-item-heading' => 'border-bottom-style: {{VALUE}};', | |
| 417 | + ], | |
| 418 | + ] | |
| 419 | + ); | |
| 420 | + | |
| 421 | + $this->add_control( | |
| 422 | + 'kng_price_list_line_color_under', | |
| 423 | + [ | |
| 424 | + 'label' => esc_html__('Line Color', 'king-addons'), | |
| 425 | + 'type' => Controls_Manager::COLOR, | |
| 426 | + 'default' => '#1E1E1E33', | |
| 427 | + 'selectors' => [ | |
| 428 | + '{{WRAPPER}} .king-addons-price-list-item-heading' => 'border-bottom-color: {{VALUE}};', | |
| 429 | + ], | |
| 430 | + ] | |
| 431 | + ); | |
| 432 | + | |
| 433 | + $this->add_control( | |
| 434 | + 'kng_price_list_line_width_under', | |
| 435 | + [ | |
| 436 | + 'label' => esc_html__('Line Width', 'king-addons'), | |
| 437 | + 'type' => Controls_Manager::NUMBER, | |
| 438 | + 'min' => 0, | |
| 439 | + 'default' => 1, | |
| 440 | + 'step' => 1, | |
| 441 | + 'selectors' => [ | |
| 442 | + '{{WRAPPER}} .king-addons-price-list-item-heading' => 'border-bottom-width: {{SIZE}}px;', | |
| 443 | + ], | |
| 444 | + ] | |
| 445 | + ); | |
| 446 | + | |
| 447 | + $this->add_responsive_control( | |
| 448 | + 'kng_price_list_line_under_space', | |
| 449 | + [ | |
| 450 | + 'label' => esc_html__('Space (px)', 'king-addons'), | |
| 451 | + 'type' => Controls_Manager::NUMBER, | |
| 452 | + 'min' => 0, | |
| 453 | + 'default' => 20, | |
| 454 | + 'step' => 1, | |
| 455 | + 'selectors' => [ | |
| 456 | + '{{WRAPPER}} .king-addons-price-list-item-heading' => 'margin-bottom: calc({{SIZE}}px / 2); padding-bottom: calc({{SIZE}}px / 2);', | |
| 457 | + ], | |
| 458 | + 'condition' => [ | |
| 459 | + 'kng_price_list_line_type_under' => ['solid', 'dotted', 'dashed'] | |
| 460 | + ] | |
| 461 | + ] | |
| 462 | + ); | |
| 463 | + | |
| 464 | + $this->add_control( | |
| 465 | + 'kng_price_list_line_heading_3', | |
| 466 | + [ | |
| 467 | + 'label' => esc_html__('Between Items', 'king-addons'), | |
| 468 | + 'type' => Controls_Manager::HEADING, | |
| 469 | + 'separator' => 'before', | |
| 470 | + ] | |
| 471 | + ); | |
| 472 | + | |
| 473 | + $this->add_control( | |
| 474 | + 'kng_price_list_line_type_items', | |
| 475 | + [ | |
| 476 | + 'label' => esc_html__('Line Type', 'king-addons'), | |
| 477 | + 'type' => Controls_Manager::SELECT, | |
| 478 | + 'options' => [ | |
| 479 | + 'none' => esc_html__('None', 'king-addons'), | |
| 480 | + 'solid' => esc_html__('Solid', 'king-addons'), | |
| 481 | + 'dotted' => esc_html__('Dotted', 'king-addons'), | |
| 482 | + 'dashed' => esc_html__('Dashed', 'king-addons'), | |
| 483 | + ], | |
| 484 | + 'default' => 'none', | |
| 485 | + 'selectors' => [ | |
| 486 | + '{{WRAPPER}} .king-addons-price-list-item' => 'border-bottom-style: {{VALUE}};', | |
| 487 | + ], | |
| 488 | + ] | |
| 489 | + ); | |
| 490 | + | |
| 491 | + $this->add_control( | |
| 492 | + 'kng_price_list_line_color_items', | |
| 493 | + [ | |
| 494 | + 'label' => esc_html__('Line Color', 'king-addons'), | |
| 495 | + 'type' => Controls_Manager::COLOR, | |
| 496 | + 'default' => '#1E1E1E33', | |
| 497 | + 'selectors' => [ | |
| 498 | + '{{WRAPPER}} .king-addons-price-list-item' => 'border-bottom-color: {{VALUE}};', | |
| 499 | + ], | |
| 500 | + ] | |
| 501 | + ); | |
| 502 | + | |
| 503 | + $this->add_control( | |
| 504 | + 'kng_price_list_line_width_items', | |
| 505 | + [ | |
| 506 | + 'label' => esc_html__('Line Width', 'king-addons'), | |
| 507 | + 'type' => Controls_Manager::NUMBER, | |
| 508 | + 'min' => 0, | |
| 509 | + 'default' => 1, | |
| 510 | + 'step' => 1, | |
| 511 | + 'selectors' => [ | |
| 512 | + '{{WRAPPER}} .king-addons-price-list-item' => 'border-bottom-width: {{SIZE}}px;', | |
| 513 | + ], | |
| 514 | + ] | |
| 515 | + ); | |
| 516 | + | |
| 517 | + $this->end_controls_section(); | |
| 518 | + /** END STYLE SECTION: Lines ===================== */ | |
| 519 | + | |
| 520 | + /** STYLE SECTION: Image ===================== */ | |
| 521 | + $this->start_controls_section( | |
| 522 | + 'kng_card_carousel_style_section_image', | |
| 523 | + [ | |
| 524 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Image', 'king-addons'), | |
| 525 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 526 | + ] | |
| 527 | + ); | |
| 528 | + | |
| 529 | + $this->add_responsive_control( | |
| 530 | + 'kng_price_list_image_width_type', | |
| 531 | + [ | |
| 532 | + 'label' => esc_html__('Width', 'king-addons'), | |
| 533 | + 'type' => Controls_Manager::SELECT, | |
| 534 | + 'options' => [ | |
| 535 | + 'auto' => esc_html__('Auto', 'king-addons'), | |
| 536 | + 'custom-pct' => esc_html__('Custom (%)', 'king-addons'), | |
| 537 | + 'custom-px' => esc_html__('Custom (px)', 'king-addons'), | |
| 538 | + ], | |
| 539 | + 'default' => 'custom-px', | |
| 540 | + ] | |
| 541 | + ); | |
| 542 | + | |
| 543 | + $this->add_responsive_control( | |
| 544 | + 'kng_price_list_image_height_type', | |
| 545 | + [ | |
| 546 | + 'label' => esc_html__('Height', 'king-addons'), | |
| 547 | + 'type' => Controls_Manager::SELECT, | |
| 548 | + 'options' => [ | |
| 549 | + 'auto' => esc_html__('Auto', 'king-addons'), | |
| 550 | + 'custom-px' => esc_html__('Custom (px)', 'king-addons'), | |
| 551 | + ], | |
| 552 | + 'default' => 'custom-px', | |
| 553 | + ] | |
| 554 | + ); | |
| 555 | + | |
| 556 | + $this->add_responsive_control( | |
| 557 | + 'kng_price_list_image_width_px', | |
| 558 | + [ | |
| 559 | + 'label' => esc_html__('Width (px)', 'king-addons'), | |
| 560 | + 'type' => Controls_Manager::NUMBER, | |
| 561 | + 'min' => 0, | |
| 562 | + 'step' => 1, | |
| 563 | + 'default' => 60, | |
| 564 | + 'selectors' => [ | |
| 565 | + '{{WRAPPER}} .king-addons-price-list-item-image' => 'width: {{SIZE}}px;' | |
| 566 | + ], | |
| 567 | + 'condition' => [ | |
| 568 | + 'kng_price_list_image_width_type' => 'custom-px' | |
| 569 | + ] | |
| 570 | + ] | |
| 571 | + ); | |
| 572 | + | |
| 573 | + $this->add_responsive_control( | |
| 574 | + 'kng_price_list_image_width_pct', | |
| 575 | + [ | |
| 576 | + 'label' => esc_html__('Width (%)', 'king-addons'), | |
| 577 | + 'type' => Controls_Manager::NUMBER, | |
| 578 | + 'min' => 0, | |
| 579 | + 'max' => 100, | |
| 580 | + 'step' => 1, | |
| 581 | + 'default' => 20, | |
| 582 | + 'selectors' => [ | |
| 583 | + '{{WRAPPER}} .king-addons-price-list-item-image' => 'width: {{SIZE}}%;' | |
| 584 | + ], | |
| 585 | + 'condition' => [ | |
| 586 | + 'kng_price_list_image_width_type' => 'custom-pct' | |
| 587 | + ] | |
| 588 | + ] | |
| 589 | + ); | |
| 590 | + | |
| 591 | + $this->add_responsive_control( | |
| 592 | + 'kng_price_list_image_height_px', | |
| 593 | + [ | |
| 594 | + 'label' => esc_html__('Height (px)', 'king-addons'), | |
| 595 | + 'type' => Controls_Manager::NUMBER, | |
| 596 | + 'min' => 0, | |
| 597 | + 'step' => 1, | |
| 598 | + 'default' => 60, | |
| 599 | + 'selectors' => [ | |
| 600 | + '{{WRAPPER}} .king-addons-price-list-item-image' => 'height: {{SIZE}}px;' | |
| 601 | + ], | |
| 602 | + 'condition' => [ | |
| 603 | + 'kng_price_list_image_height_type' => 'custom-px' | |
| 604 | + ] | |
| 605 | + ] | |
| 606 | + ); | |
| 607 | + | |
| 608 | + $this->add_responsive_control( | |
| 609 | + 'kng_price_list_image_fit', | |
| 610 | + [ | |
| 611 | + 'label' => esc_html__('Image Fit', 'king-addons'), | |
| 612 | + 'type' => Controls_Manager::SELECT, | |
| 613 | + 'options' => [ | |
| 614 | + 'cover' => esc_html__('Cover', 'king-addons'), | |
| 615 | + 'contain' => esc_html__('Contain', 'king-addons'), | |
| 616 | + ], | |
| 617 | + 'default' => 'cover', | |
| 618 | + 'separator' => 'before', | |
| 619 | + 'selectors' => [ | |
| 620 | + '{{WRAPPER}} .king-addons-price-list-item-image img' => 'object-fit: {{VALUE}};', | |
| 621 | + ], | |
| 622 | + ] | |
| 623 | + ); | |
| 624 | + | |
| 625 | + $this->add_responsive_control( | |
| 626 | + 'kng_price_list_image_fit_position', | |
| 627 | + [ | |
| 628 | + 'label' => esc_html__('Image Fit Position', 'king-addons'), | |
| 629 | + 'type' => Controls_Manager::SELECT, | |
| 630 | + 'options' => [ | |
| 631 | + 'top' => esc_html__('Top', 'king-addons'), | |
| 632 | + 'bottom' => esc_html__('Bottom', 'king-addons'), | |
| 633 | + 'left' => esc_html__('Left', 'king-addons'), | |
| 634 | + 'right' => esc_html__('Right', 'king-addons'), | |
| 635 | + 'center' => esc_html__('Center', 'king-addons'), | |
| 636 | + ], | |
| 637 | + 'default' => 'center', | |
| 638 | + 'selectors' => [ | |
| 639 | + '{{WRAPPER}} .king-addons-price-list-item-image img' => 'object-position: {{VALUE}};', | |
| 640 | + ], | |
| 641 | + 'condition' => [ | |
| 642 | + 'kng_price_list_image_fit' => 'cover' | |
| 643 | + ] | |
| 644 | + ] | |
| 645 | + ); | |
| 646 | + | |
| 647 | + $this->add_control( | |
| 648 | + 'kng_price_list_image_bg_color', | |
| 649 | + [ | |
| 650 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 651 | + 'type' => Controls_Manager::COLOR, | |
| 652 | + 'default' => '', | |
| 653 | + 'selectors' => [ | |
| 654 | + '{{WRAPPER}} .king-addons-price-list-item-image' => 'background-color: {{VALUE}}', | |
| 655 | + ], | |
| 656 | + 'separator' => 'before', | |
| 657 | + ] | |
| 658 | + ); | |
| 659 | + | |
| 660 | + $this->add_control( | |
| 661 | + 'kng_price_list_image_move_to_top_on_mobile', | |
| 662 | + [ | |
| 663 | + 'label' => esc_html__('Move image to the top on mobile', 'king-addons'), | |
| 664 | + 'type' => Controls_Manager::SWITCHER, | |
| 665 | + ] | |
| 666 | + ); | |
| 667 | + | |
| 668 | + $this->add_group_control( | |
| 669 | + Group_Control_Css_Filter::get_type(), | |
| 670 | + [ | |
| 671 | + 'label' => esc_html__('CSS Filter', 'king-addons'), | |
| 672 | + 'name' => 'kng_price_list_image_css_filters', | |
| 673 | + 'selector' => '{{WRAPPER}} .king-addons-price-list-item-image', | |
| 674 | + ] | |
| 675 | + ); | |
| 676 | + | |
| 677 | + $this->add_group_control( | |
| 678 | + Group_Control_Css_Filter::get_type(), | |
| 679 | + [ | |
| 680 | + 'label' => esc_html__('CSS Filter for image on card hover', 'king-addons'), | |
| 681 | + 'name' => 'kng_price_list_image_css_filters_hover', | |
| 682 | + 'selector' => '{{WRAPPER}} .king-addons-price-list-item:hover .king-addons-price-list-item-image', | |
| 683 | + ] | |
| 684 | + ); | |
| 685 | + | |
| 686 | + $this->add_responsive_control( | |
| 687 | + 'kng_price_list_image_transition', | |
| 688 | + [ | |
| 689 | + 'label' => esc_html__('Transition duration on hover (ms)', 'king-addons'), | |
| 690 | + 'type' => Controls_Manager::NUMBER, | |
| 691 | + 'min' => 0, | |
| 692 | + 'step' => 10, | |
| 693 | + 'default' => 300, | |
| 694 | + 'selectors' => [ | |
| 695 | + '{{WRAPPER}} .king-addons-price-list-item-image' => 'transition: all {{SIZE}}ms;' | |
| 696 | + ], | |
| 697 | + ] | |
| 698 | + ); | |
| 699 | + | |
| 700 | + $this->add_responsive_control( | |
| 701 | + 'kng_price_list_image_padding', | |
| 702 | + [ | |
| 703 | + 'label' => esc_html__('Padding', 'king-addons'), | |
| 704 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 705 | + 'size_units' => ['px', '%'], | |
| 706 | + 'default' => [ | |
| 707 | + 'top' => 0, | |
| 708 | + 'right' => 0, | |
| 709 | + 'bottom' => 0, | |
| 710 | + 'left' => 0, | |
| 711 | + 'unit' => 'px', | |
| 712 | + ], | |
| 713 | + 'selectors' => [ | |
| 714 | + '{{WRAPPER}} .king-addons-price-list-item-image' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 715 | + ] | |
| 716 | + ] | |
| 717 | + ); | |
| 718 | + | |
| 719 | + $this->add_responsive_control( | |
| 720 | + 'kng_price_list_image_margin', | |
| 721 | + [ | |
| 722 | + 'label' => esc_html__('Margin', 'king-addons'), | |
| 723 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 724 | + 'size_units' => ['px', '%'], | |
| 725 | + 'default' => [ | |
| 726 | + 'top' => 0, | |
| 727 | + 'right' => 20, | |
| 728 | + 'bottom' => 0, | |
| 729 | + 'left' => 0, | |
| 730 | + 'unit' => 'px', | |
| 731 | + ], | |
| 732 | + 'selectors' => [ | |
| 733 | + '{{WRAPPER}} .king-addons-price-list-item-image' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 734 | + ] | |
| 735 | + ] | |
| 736 | + ); | |
| 737 | + | |
| 738 | + $this->add_group_control( | |
| 739 | + Group_Control_Box_Shadow::get_type(), | |
| 740 | + [ | |
| 741 | + 'name' => 'kng_price_list_image_box_shadow', | |
| 742 | + 'selector' => '{{WRAPPER}} .king-addons-price-list-item-image', | |
| 743 | + ] | |
| 744 | + ); | |
| 745 | + | |
| 746 | + $this->add_group_control( | |
| 747 | + Group_Control_Border::get_type(), | |
| 748 | + [ | |
| 749 | + 'name' => 'kng_price_list_image_border', | |
| 750 | + 'selector' => '{{WRAPPER}} .king-addons-price-list-item-image', | |
| 751 | + 'fields_options' => [ | |
| 752 | + 'border' => [ | |
| 753 | + 'default' => 'none', | |
| 754 | + ], | |
| 755 | + ], | |
| 756 | + ] | |
| 757 | + ); | |
| 758 | + | |
| 759 | + $this->add_responsive_control( | |
| 760 | + 'kng_price_list_image_border_radius', | |
| 761 | + [ | |
| 762 | + 'label' => esc_html__('Border Radius', 'king-addons'), | |
| 763 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 764 | + 'size_units' => ['px', '%'], | |
| 765 | + 'default' => [ | |
| 766 | + 'top' => 0, | |
| 767 | + 'right' => 0, | |
| 768 | + 'bottom' => 0, | |
| 769 | + 'left' => 0, | |
| 770 | + 'unit' => 'px', | |
| 771 | + ], | |
| 772 | + 'selectors' => [ | |
| 773 | + '{{WRAPPER}} .king-addons-price-list-item-image' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 774 | + ] | |
| 775 | + ] | |
| 776 | + ); | |
| 777 | + | |
| 778 | + $this->end_controls_section(); | |
| 779 | + /** END: Image */ | |
| 780 | + } | |
| 781 | + | |
| 782 | + protected function render(): void | |
| 783 | + { | |
| 784 | + $settings = Core::displaySettings($this); | |
| 785 | + | |
| 786 | + // Define allowed tags and attributes | |
| 787 | + $allowed_tags = wp_kses_allowed_html('post'); | |
| 788 | + $allowed_tags['img']['srcset'] = true; | |
| 789 | + $allowed_tags['img']['sizes'] = true; | |
| 790 | + $allowed_tags['img']['decoding'] = true; | |
| 791 | + $allowed_tags['img']['loading'] = true; | |
| 792 | + | |
| 793 | + echo '<div class="king-addons-price-list-items' . (('yes' === $settings['kng_price_list_image_move_to_top_on_mobile']) ? ' king-addons-price-list-mobile-collapse' : '') . '">'; | |
| 794 | + foreach ($settings['kng_price_list_content_items'] as $item) { | |
| 795 | + echo '<div class="king-addons-price-list-item elementor-repeater-item-' . esc_attr($item['_id']) . '">'; | |
| 796 | + | |
| 797 | + /** Image */ | |
| 798 | + if ('yes' !== $settings['kng_price_list_image_disable_image_swithcer']) { | |
| 799 | + echo '<div class="king-addons-price-list-item-image">'; | |
| 800 | + $image_html = Group_Control_Image_Size::get_attachment_image_html($item, 'kng_price_list_image_size', 'kng_price_list_image'); | |
| 801 | + echo wp_kses($image_html, $allowed_tags); | |
| 802 | + echo '</div>'; | |
| 803 | + } | |
| 804 | + /** END: Image */ | |
| 805 | + | |
| 806 | + echo '<div class="king-addons-price-list-item-holder">'; | |
| 807 | + | |
| 808 | + echo '<div class="king-addons-price-list-item-heading">'; | |
| 809 | + echo '<div class="king-addons-price-list-item-title">' . wp_kses_post($item['kng_price_list_title']) . '</div>'; | |
| 810 | + echo '<div class="king-addons-price-list-item-line"></div>'; | |
| 811 | + echo '<div class="king-addons-price-list-item-price">' . wp_kses_post($item['kng_price_list_price']) . '</div>'; | |
| 812 | + echo '</div>'; | |
| 813 | + | |
| 814 | + echo '<div class="king-addons-price-list-item-description">' . wp_kses_post($item['kng_price_list_description']) . '</div>'; | |
| 815 | + | |
| 816 | + echo '</div>'; // close holder | |
| 817 | + | |
| 818 | + echo '</div>'; | |
| 819 | + } | |
| 820 | + echo '</div>'; | |
| 821 | + } | |
| 822 | +} | |