| @@ -12,16 +12,15 @@ | ||
| 12 | 12 | use Elementor\Group_Control_Text_Shadow; |
| 13 | 13 | use Elementor\Group_Control_Background; |
| 14 | 14 | use Elementor\Group_Control_Border; |
| 15 | 15 | use Elementor\Icons_Manager; |
| 16 | - use Elementor\Utils; | |
| 16 | + use UltimateStoreKit\Classes\Utils; | |
| 17 | 17 | |
| 18 | 18 | if (! defined('ABSPATH')) { |
| 19 | 19 | exit; |
| 20 | 20 | } // Exit if accessed directly |
| 21 | 21 | |
| 22 | -class Info_List extends Module_Base | |
| 23 | -{ | |
| 22 | +class Info_List extends Module_Base { | |
| 24 | 23 | |
| 25 | 24 | public function get_name() |
| 26 | 25 | { |
| 27 | 26 | return 'usk-info-list'; |
| @@ -59,15 +58,114 @@ | ||
| 59 | 58 | public function get_custom_help_url() { |
| 60 | 59 | return 'https://youtu.be/vVCYUAPuqcg?si=ld1BjZ6KIy3OU62Y'; |
| 61 | 60 | } |
| 62 | 61 | |
| 63 | - protected function register_controls() | |
| 64 | - { | |
| 62 | + public function has_widget_inner_wrapper(): bool { | |
| 63 | + return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 64 | + } | |
| 65 | + | |
| 66 | + protected function is_dynamic_content(): bool { | |
| 67 | + return false; | |
| 68 | + } | |
| 69 | + | |
| 70 | + protected function register_controls() { | |
| 71 | + | |
| 72 | + $this->start_controls_section( | |
| 73 | + 'usk_section_list', | |
| 74 | + [ | |
| 75 | + 'label' => __('Items', 'ultimate-store-kit'), | |
| 76 | + 'tab' => Controls_Manager::TAB_CONTENT, | |
| 77 | + ] | |
| 78 | + ); | |
| 65 | 79 | |
| 80 | + $repeater = new Repeater(); | |
| 81 | + | |
| 82 | + $repeater->add_control( | |
| 83 | + 'list_icon', | |
| 84 | + [ | |
| 85 | + 'label' => __('Icon', 'ultimate-store-kit'), | |
| 86 | + 'type' => Controls_Manager::ICONS, | |
| 87 | + 'label_block' => false, | |
| 88 | + 'default' => [ | |
| 89 | + 'value' => 'fas fa-star', | |
| 90 | + 'library' => 'fa-solid', | |
| 91 | + ], | |
| 92 | + 'skin' => 'inline', | |
| 93 | + ] | |
| 94 | + ); | |
| 95 | + | |
| 96 | + $repeater->add_control( | |
| 97 | + 'title', | |
| 98 | + [ | |
| 99 | + 'label' => __('Title', 'ultimate-store-kit'), | |
| 100 | + 'type' => Controls_Manager::TEXT, | |
| 101 | + 'dynamic' => [ | |
| 102 | + 'active' => true, | |
| 103 | + ], | |
| 104 | + 'default' => esc_html__('This is a title', 'ultimate-store-kit'), | |
| 105 | + 'placeholder' => __('Enter your title', 'ultimate-store-kit'), | |
| 106 | + 'label_block' => true, | |
| 107 | + ] | |
| 108 | + ); | |
| 109 | + | |
| 110 | + $repeater->add_control( | |
| 111 | + 'title_link', | |
| 112 | + [ | |
| 113 | + 'label' => esc_html__('Title Link', 'ultimate-store-kit'), | |
| 114 | + 'type' => Controls_Manager::URL, | |
| 115 | + 'dynamic' => [ 'active' => true ], | |
| 116 | + 'placeholder' => 'http://your-link.com', | |
| 117 | + ] | |
| 118 | + ); | |
| 119 | + | |
| 120 | + $repeater->add_control( | |
| 121 | + 'text', | |
| 122 | + [ | |
| 123 | + 'label' => esc_html__('Text', 'ultimate-store-kit'), | |
| 124 | + 'type' => Controls_Manager::WYSIWYG, | |
| 125 | + 'label_block' => true, | |
| 126 | + 'dynamic' => ['active' => true], | |
| 127 | + 'default' => esc_html__('Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'ultimate-store-kit'), | |
| 128 | + | |
| 129 | + ] | |
| 130 | + ); | |
| 131 | + | |
| 132 | + $repeater->add_group_control( | |
| 133 | + Group_Control_Background::get_type(), | |
| 134 | + [ | |
| 135 | + 'name' => 'item_repeater_background', | |
| 136 | + 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.usk-info-list-item', | |
| 137 | + 'separator' => 'before' | |
| 138 | + ] | |
| 139 | + ); | |
| 140 | + | |
| 141 | + $this->add_control( | |
| 142 | + 'info_items', | |
| 143 | + [ | |
| 144 | + 'show_label' => false, | |
| 145 | + 'type' => Controls_Manager::REPEATER, | |
| 146 | + 'fields' => $repeater->get_controls(), | |
| 147 | + 'default' => [ | |
| 148 | + [ | |
| 149 | + 'title' => __('List Item #1', 'ultimate-store-kit'), | |
| 150 | + ], | |
| 151 | + [ | |
| 152 | + 'title' => __('List Item #2', 'ultimate-store-kit'), | |
| 153 | + ], | |
| 154 | + [ | |
| 155 | + 'title' => __('List Item #3', 'ultimate-store-kit'), | |
| 156 | + ], | |
| 157 | + ], | |
| 158 | + 'title_field' => '{{{ elementor.helpers.renderIcon( this, list_icon, {}, "i", "panel" ) || \'<i class="{{ icon }}" aria-hidden="true"></i>\' }}} {{{ title }}}', | |
| 159 | + ] | |
| 160 | + ); | |
| 161 | + | |
| 162 | + $this->end_controls_section(); | |
| 163 | + | |
| 66 | 164 | $this->start_controls_section( |
| 67 | 165 | 'section_layout', |
| 68 | 166 | [ |
| 69 | - 'label' => __('Layout', 'ultimate-store-kit'), | |
| 167 | + 'label' => __('Additional Options', 'ultimate-store-kit'), | |
| 70 | 168 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 71 | 169 | ] |
| 72 | 170 | ); |
| 73 | 171 | |
| @@ -244,114 +342,11 @@ | ||
| 244 | 342 | 'default' => 'yes', |
| 245 | 343 | ] |
| 246 | 344 | ); |
| 247 | 345 | |
| 248 | - $this->add_group_control( | |
| 249 | - Group_Control_Image_Size::get_type(), | |
| 250 | - [ | |
| 251 | - 'name' => 'thumbnail', | |
| 252 | - 'default' => 'medium', | |
| 253 | - 'separator' => 'before', | |
| 254 | - 'exclude' => ['custom'] | |
| 255 | - ] | |
| 256 | - ); | |
| 257 | - | |
| 258 | 346 | $this->end_controls_section(); |
| 259 | 347 | |
| 260 | 348 | $this->start_controls_section( |
| 261 | - 'usk_section_list', | |
| 262 | - [ | |
| 263 | - 'label' => __('Items', 'ultimate-store-kit'), | |
| 264 | - 'tab' => Controls_Manager::TAB_CONTENT, | |
| 265 | - ] | |
| 266 | - ); | |
| 267 | - | |
| 268 | - $repeater = new Repeater(); | |
| 269 | - | |
| 270 | - $repeater->add_control( | |
| 271 | - 'list_icon', | |
| 272 | - [ | |
| 273 | - 'label' => __('Icon', 'bdthemes-element-pack'), | |
| 274 | - 'type' => Controls_Manager::ICONS, | |
| 275 | - 'label_block' => false, | |
| 276 | - 'default' => [ | |
| 277 | - 'value' => 'fas fa-star', | |
| 278 | - 'library' => 'fa-solid', | |
| 279 | - ], | |
| 280 | - 'skin' => 'inline', | |
| 281 | - ] | |
| 282 | - ); | |
| 283 | - | |
| 284 | - $repeater->add_control( | |
| 285 | - 'title', | |
| 286 | - [ | |
| 287 | - 'label' => __('Title', 'ultimate-store-kit'), | |
| 288 | - 'type' => Controls_Manager::TEXT, | |
| 289 | - 'dynamic' => [ | |
| 290 | - 'active' => true, | |
| 291 | - ], | |
| 292 | - 'default' => esc_html__('This is a title', 'ultimate-store-kit'), | |
| 293 | - 'placeholder' => __('Enter your title', 'ultimate-store-kit'), | |
| 294 | - 'label_block' => true, | |
| 295 | - ] | |
| 296 | - ); | |
| 297 | - | |
| 298 | - $repeater->add_control( | |
| 299 | - 'title_link', | |
| 300 | - [ | |
| 301 | - 'label' => esc_html__('Title Link', 'ultimate-store-kit'), | |
| 302 | - 'type' => Controls_Manager::URL, | |
| 303 | - 'dynamic' => [ 'active' => true ], | |
| 304 | - 'placeholder' => 'http://your-link.com', | |
| 305 | - ] | |
| 306 | - ); | |
| 307 | - | |
| 308 | - $repeater->add_control( | |
| 309 | - 'text', | |
| 310 | - [ | |
| 311 | - 'label' => esc_html__('Text', 'bdthemes-prime-slider'), | |
| 312 | - 'type' => Controls_Manager::WYSIWYG, | |
| 313 | - 'label_block' => true, | |
| 314 | - 'dynamic' => ['active' => true], | |
| 315 | - 'default' => esc_html__('Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'bdthemes-element-pack'), | |
| 316 | - | |
| 317 | - ] | |
| 318 | - ); | |
| 319 | - | |
| 320 | - $repeater->add_group_control( | |
| 321 | - Group_Control_Background::get_type(), | |
| 322 | - [ | |
| 323 | - 'name' => 'item_repeater_background', | |
| 324 | - 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.usk-info-list-item', | |
| 325 | - 'separator' => 'before' | |
| 326 | - ] | |
| 327 | - ); | |
| 328 | - | |
| 329 | - $this->add_control( | |
| 330 | - 'info_items', | |
| 331 | - [ | |
| 332 | - 'show_label' => false, | |
| 333 | - 'type' => Controls_Manager::REPEATER, | |
| 334 | - 'fields' => $repeater->get_controls(), | |
| 335 | - 'default' => [ | |
| 336 | - [ | |
| 337 | - 'title' => __('List Item #1', 'bdthemes-element-pack'), | |
| 338 | - ], | |
| 339 | - [ | |
| 340 | - 'title' => __('List Item #2', 'bdthemes-element-pack'), | |
| 341 | - ], | |
| 342 | - [ | |
| 343 | - 'title' => __('List Item #3', 'bdthemes-element-pack'), | |
| 344 | - ], | |
| 345 | - ], | |
| 346 | - 'title_field' => '{{{ elementor.helpers.renderIcon( this, list_icon, {}, "i", "panel" ) || \'<i class="{{ icon }}" aria-hidden="true"></i>\' }}} {{{ title }}}', | |
| 347 | - ] | |
| 348 | - ); | |
| 349 | - | |
| 350 | - $this->end_controls_section(); | |
| 351 | - | |
| 352 | - //Style | |
| 353 | - $this->start_controls_section( | |
| 354 | 349 | 'section_style_items', |
| 355 | 350 | [ |
| 356 | 351 | 'label' => __('Items', 'ultimate-store-kit'), |
| 357 | 352 | 'tab' => Controls_Manager::TAB_STYLE, |
| @@ -378,9 +373,9 @@ | ||
| 378 | 373 | $this->add_group_control( |
| 379 | 374 | Group_Control_Border::get_type(), |
| 380 | 375 | [ |
| 381 | 376 | 'name' => 'item_border', |
| 382 | - 'label' => esc_html__('Border', 'bdthemes-element-pack'), | |
| 377 | + 'label' => esc_html__('Border', 'ultimate-store-kit'), | |
| 383 | 378 | 'fields_options' => [ |
| 384 | 379 | 'border' => [ |
| 385 | 380 | 'default' => 'solid', |
| 386 | 381 | ], |
| @@ -483,9 +478,9 @@ | ||
| 483 | 478 | |
| 484 | 479 | $this->start_controls_section( |
| 485 | 480 | 'section_title_style', |
| 486 | 481 | [ |
| 487 | - 'label' => __('Title', 'bdthemes-element-pack'), | |
| 482 | + 'label' => __('Title', 'ultimate-store-kit'), | |
| 488 | 483 | 'tab' => Controls_Manager::TAB_STYLE, |
| 489 | 484 | ] |
| 490 | 485 | ); |
| 491 | 486 | |
| @@ -491,9 +486,9 @@ | ||
| 491 | 486 | |
| 492 | 487 | $this->add_control( |
| 493 | 488 | 'title_color', |
| 494 | 489 | [ |
| 495 | - 'label' => __('Color', 'bdthemes-element-pack'), | |
| 490 | + 'label' => __('Color', 'ultimate-store-kit'), | |
| 496 | 491 | 'type' => Controls_Manager::COLOR, |
| 497 | 492 | 'selectors' => [ |
| 498 | 493 | '{{WRAPPER}} .usk-info-list-title a' => 'color: {{VALUE}} ', |
| 499 | 494 | ], |
| @@ -502,9 +497,9 @@ | ||
| 502 | 497 | |
| 503 | 498 | $this->add_control( |
| 504 | 499 | 'title_hover_color', |
| 505 | 500 | [ |
| 506 | - 'label' => __('Hover Color', 'bdthemes-element-pack'), | |
| 501 | + 'label' => __('Hover Color', 'ultimate-store-kit'), | |
| 507 | 502 | 'type' => Controls_Manager::COLOR, |
| 508 | 503 | 'selectors' => [ |
| 509 | 504 | '{{WRAPPER}} .usk-info-list-title a:hover' => 'color: {{VALUE}} ', |
| 510 | 505 | ], |
| @@ -535,9 +530,9 @@ | ||
| 535 | 530 | |
| 536 | 531 | $this->start_controls_section( |
| 537 | 532 | 'section_style_text', |
| 538 | 533 | [ |
| 539 | - 'label' => __('Text', 'bdthemes-element-pack'), | |
| 534 | + 'label' => __('Text', 'ultimate-store-kit'), | |
| 540 | 535 | 'tab' => Controls_Manager::TAB_STYLE, |
| 541 | 536 | ] |
| 542 | 537 | ); |
| 543 | 538 | |
| @@ -543,9 +538,9 @@ | ||
| 543 | 538 | |
| 544 | 539 | $this->add_control( |
| 545 | 540 | 'text_color', |
| 546 | 541 | [ |
| 547 | - 'label' => __('Color', 'bdthemes-element-pack'), | |
| 542 | + 'label' => __('Color', 'ultimate-store-kit'), | |
| 548 | 543 | 'type' => Controls_Manager::COLOR, |
| 549 | 544 | 'selectors' => [ |
| 550 | 545 | '{{WRAPPER}} .usk-info-list-text' => 'color: {{VALUE}};', |
| 551 | 546 | ], |
| @@ -597,8 +592,9 @@ | ||
| 597 | 592 | 'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 598 | 593 | 'type' => Controls_Manager::COLOR, |
| 599 | 594 | 'selectors' => [ |
| 600 | 595 | '{{WRAPPER}} .usk-info-list-icon span' => 'color: {{VALUE}};', |
| 596 | + '{{WRAPPER}} .usk-info-list-icon svg' => 'fill: {{VALUE}};', | |
| 601 | 597 | ], |
| 602 | 598 | ] |
| 603 | 599 | ); |
| 604 | 600 | |
| @@ -686,8 +682,9 @@ | ||
| 686 | 682 | 'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 687 | 683 | 'type' => Controls_Manager::COLOR, |
| 688 | 684 | 'selectors' => [ |
| 689 | 685 | '{{WRAPPER}} .usk-info-list-icon span:hover' => 'color: {{VALUE}};', |
| 686 | + '{{WRAPPER}} .usk-info-list-icon span:hover svg' => 'fill: {{VALUE}};', | |
| 690 | 687 | ], |
| 691 | 688 | ] |
| 692 | 689 | ); |
| 693 | 690 | |
| @@ -713,11 +710,9 @@ | ||
| 713 | 710 | ] |
| 714 | 711 | ); |
| 715 | 712 | |
| 716 | 713 | $this->end_controls_tab(); |
| 717 | - | |
| 718 | 714 | $this->end_controls_tabs(); |
| 719 | - | |
| 720 | 715 | $this->end_controls_section(); |
| 721 | 716 | } |
| 722 | 717 | |
| 723 | 718 | |
| @@ -728,22 +723,19 @@ | ||
| 728 | 723 | if (! $settings['show_title']) { |
| 729 | 724 | return; |
| 730 | 725 | } |
| 731 | 726 | |
| 732 | - $this->add_render_attribute( | |
| 733 | - [ | |
| 734 | - 'title-link' => [ | |
| 735 | - 'href' => isset($item['title_link']['url']) && !empty($item['title_link']['url']) ? esc_url($item['title_link']['url']) : 'javascript:void(0);', | |
| 736 | - 'target' => $item['title_link']['is_external'] ? '_blank' : '_self' | |
| 737 | - ] | |
| 738 | - ], | |
| 739 | - '', | |
| 740 | - '', | |
| 741 | - true | |
| 742 | - ); | |
| 727 | + if ( !empty($item['title']) && !empty($item['title_link']['url']) ) { | |
| 728 | + $this->add_link_attributes('title-link', $item['title_link'], true); | |
| 729 | + } | |
| 743 | 730 | |
| 744 | 731 | if (!empty($item['title'])) { |
| 745 | - printf('<%1$s class="usk-info-list-title"><a %2$s title="%3$s">%3$s</a></%1$s>', esc_attr($settings['title_tag']), $this->get_render_attribute_string('title-link'), wp_kses_post($item['title'])); | |
| 732 | + printf( | |
| 733 | + '<%1$s class="usk-info-list-title"><a %2$s title="%3$s">%3$s</a></%1$s>', | |
| 734 | + esc_attr( Utils::get_valid_html_tag($settings['title_tag']) ), | |
| 735 | + $this->get_render_attribute_string('title-link'), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 736 | + esc_attr($item['title']) | |
| 737 | + ); | |
| 746 | 738 | } |
| 747 | 739 | } |
| 748 | 740 | |
| 749 | 741 | public function render_text($item) |