| @@ -5,9 +5,8 @@ | ||
| 5 | 5 | exit; // Exit if accessed directly. |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | use Elementor\Core\Kits\Documents\Tabs\Global_Colors; |
| 9 | -use Elementor\Modules\Promotions\Controls\Promotion_Control; | |
| 10 | 9 | |
| 11 | 10 | /** |
| 12 | 11 | * Elementor image carousel widget. |
| 13 | 12 | * |
| @@ -73,66 +72,9 @@ | ||
| 73 | 72 | public function get_keywords() { |
| 74 | 73 | return [ 'image', 'photo', 'visual', 'carousel', 'slider' ]; |
| 75 | 74 | } |
| 76 | 75 | |
| 77 | - protected function is_dynamic_content(): bool { | |
| 78 | - return false; | |
| 79 | - } | |
| 80 | - | |
| 81 | 76 | /** |
| 82 | - * Get style dependencies. | |
| 83 | - * | |
| 84 | - * Retrieve the list of style dependencies the widget requires. | |
| 85 | - * | |
| 86 | - * @since 3.24.0 | |
| 87 | - * @access public | |
| 88 | - * | |
| 89 | - * @return array Widget style dependencies. | |
| 90 | - */ | |
| 91 | - public function get_style_depends(): array { | |
| 92 | - return [ 'e-swiper', 'widget-image-carousel' ]; | |
| 93 | - } | |
| 94 | - | |
| 95 | - /** | |
| 96 | - * Get script dependencies. | |
| 97 | - * | |
| 98 | - * Retrieve the list of script dependencies the widget requires. | |
| 99 | - * | |
| 100 | - * @since 3.27.0 | |
| 101 | - * @access public | |
| 102 | - * | |
| 103 | - * @return array Widget script dependencies. | |
| 104 | - */ | |
| 105 | - public function get_script_depends(): array { | |
| 106 | - return [ 'swiper' ]; | |
| 107 | - } | |
| 108 | - | |
| 109 | - public function has_widget_inner_wrapper(): bool { | |
| 110 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 111 | - } | |
| 112 | - | |
| 113 | - /** | |
| 114 | - * Get widget upsale data. | |
| 115 | - * | |
| 116 | - * Retrieve the widget promotion data. | |
| 117 | - * | |
| 118 | - * @since 3.18.0 | |
| 119 | - * @access protected | |
| 120 | - * | |
| 121 | - * @return array Widget promotion data. | |
| 122 | - */ | |
| 123 | - protected function get_upsale_data() { | |
| 124 | - return [ | |
| 125 | - 'condition' => ! Utils::has_pro(), | |
| 126 | - 'image' => esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro.svg' ), | |
| 127 | - 'image_alt' => esc_attr__( 'Upgrade', 'elementor' ), | |
| 128 | - 'description' => esc_html__( 'Gain complete freedom to design every slide with Elementor"s Pro Carousel.', 'elementor' ), | |
| 129 | - 'upgrade_url' => esc_url( 'https://go.elementor.com/go-pro-image-carousel-widget/' ), | |
| 130 | - 'upgrade_text' => esc_html__( 'Upgrade Now', 'elementor' ), | |
| 131 | - ]; | |
| 132 | - } | |
| 133 | - | |
| 134 | - /** | |
| 135 | 77 | * Register image carousel widget controls. |
| 136 | 78 | * |
| 137 | 79 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 138 | 80 | * |
| @@ -147,17 +89,8 @@ | ||
| 147 | 89 | ] |
| 148 | 90 | ); |
| 149 | 91 | |
| 150 | 92 | $this->add_control( |
| 151 | - 'carousel_name', | |
| 152 | - [ | |
| 153 | - 'label' => esc_html__( 'Carousel Name', 'elementor' ), | |
| 154 | - 'type' => Controls_Manager::TEXT, | |
| 155 | - 'default' => esc_html__( 'Image Carousel', 'elementor' ), | |
| 156 | - ] | |
| 157 | - ); | |
| 158 | - | |
| 159 | - $this->add_control( | |
| 160 | 93 | 'carousel', |
| 161 | 94 | [ |
| 162 | 95 | 'label' => esc_html__( 'Add Images', 'elementor' ), |
| 163 | 96 | 'type' => Controls_Manager::GALLERY, |
| @@ -172,8 +105,9 @@ | ||
| 172 | 105 | $this->add_group_control( |
| 173 | 106 | Group_Control_Image_Size::get_type(), |
| 174 | 107 | [ |
| 175 | 108 | 'name' => 'thumbnail', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`. |
| 109 | + 'separator' => 'none', | |
| 176 | 110 | ] |
| 177 | 111 | ); |
| 178 | 112 | |
| 179 | 113 | $slides_to_show = range( 1, 10 ); |
| @@ -191,9 +125,8 @@ | ||
| 191 | 125 | 'render_type' => 'template', |
| 192 | 126 | 'selectors' => [ |
| 193 | 127 | '{{WRAPPER}}' => '--e-image-carousel-slides-to-show: {{VALUE}}', |
| 194 | 128 | ], |
| 195 | - 'content_classes' => 'elementor-control-field-select-small', | |
| 196 | 129 | ] |
| 197 | 130 | ); |
| 198 | 131 | |
| 199 | 132 | $this->add_responsive_control( |
| @@ -208,9 +141,8 @@ | ||
| 208 | 141 | 'condition' => [ |
| 209 | 142 | 'slides_to_show!' => '1', |
| 210 | 143 | ], |
| 211 | 144 | 'frontend_available' => true, |
| 212 | - 'content_classes' => 'elementor-control-field-select-small', | |
| 213 | 145 | ] |
| 214 | 146 | ); |
| 215 | 147 | |
| 216 | 148 | $this->add_control( |
| @@ -370,8 +302,9 @@ | ||
| 370 | 302 | 'link', |
| 371 | 303 | [ |
| 372 | 304 | 'label' => esc_html__( 'Link', 'elementor' ), |
| 373 | 305 | 'type' => Controls_Manager::URL, |
| 306 | + 'placeholder' => esc_html__( 'https://your-link.com', 'elementor' ), | |
| 374 | 307 | 'condition' => [ |
| 375 | 308 | 'link_to' => 'custom', |
| 376 | 309 | ], |
| 377 | 310 | 'show_label' => false, |
| @@ -418,8 +351,17 @@ | ||
| 418 | 351 | ], |
| 419 | 352 | ] |
| 420 | 353 | ); |
| 421 | 354 | |
| 355 | + $this->add_control( | |
| 356 | + 'view', | |
| 357 | + [ | |
| 358 | + 'label' => esc_html__( 'View', 'elementor' ), | |
| 359 | + 'type' => Controls_Manager::HIDDEN, | |
| 360 | + 'default' => 'traditional', | |
| 361 | + ] | |
| 362 | + ); | |
| 363 | + | |
| 422 | 364 | $this->end_controls_section(); |
| 423 | 365 | |
| 424 | 366 | $this->start_controls_section( |
| 425 | 367 | 'section_additional_options', |
| @@ -440,13 +382,14 @@ | ||
| 440 | 382 | $this->add_control( |
| 441 | 383 | 'autoplay', |
| 442 | 384 | [ |
| 443 | 385 | 'label' => esc_html__( 'Autoplay', 'elementor' ), |
| 444 | - 'type' => Controls_Manager::SWITCHER, | |
| 445 | - 'label_on' => esc_html__( 'Yes', 'elementor' ), | |
| 446 | - 'label_off' => esc_html__( 'No', 'elementor' ), | |
| 447 | - 'return_value' => 'yes', | |
| 386 | + 'type' => Controls_Manager::SELECT, | |
| 448 | 387 | 'default' => 'yes', |
| 388 | + 'options' => [ | |
| 389 | + 'yes' => esc_html__( 'Yes', 'elementor' ), | |
| 390 | + 'no' => esc_html__( 'No', 'elementor' ), | |
| 391 | + ], | |
| 449 | 392 | 'frontend_available' => true, |
| 450 | 393 | ] |
| 451 | 394 | ); |
| 452 | 395 | |
| @@ -453,13 +396,14 @@ | ||
| 453 | 396 | $this->add_control( |
| 454 | 397 | 'pause_on_hover', |
| 455 | 398 | [ |
| 456 | 399 | 'label' => esc_html__( 'Pause on Hover', 'elementor' ), |
| 457 | - 'type' => Controls_Manager::SWITCHER, | |
| 458 | - 'label_on' => esc_html__( 'Yes', 'elementor' ), | |
| 459 | - 'label_off' => esc_html__( 'No', 'elementor' ), | |
| 460 | - 'return_value' => 'yes', | |
| 400 | + 'type' => Controls_Manager::SELECT, | |
| 461 | 401 | 'default' => 'yes', |
| 402 | + 'options' => [ | |
| 403 | + 'yes' => esc_html__( 'Yes', 'elementor' ), | |
| 404 | + 'no' => esc_html__( 'No', 'elementor' ), | |
| 405 | + ], | |
| 462 | 406 | 'condition' => [ |
| 463 | 407 | 'autoplay' => 'yes', |
| 464 | 408 | ], |
| 465 | 409 | 'render_type' => 'none', |
| @@ -470,13 +414,14 @@ | ||
| 470 | 414 | $this->add_control( |
| 471 | 415 | 'pause_on_interaction', |
| 472 | 416 | [ |
| 473 | 417 | 'label' => esc_html__( 'Pause on Interaction', 'elementor' ), |
| 474 | - 'type' => Controls_Manager::SWITCHER, | |
| 475 | - 'label_on' => esc_html__( 'Yes', 'elementor' ), | |
| 476 | - 'label_off' => esc_html__( 'No', 'elementor' ), | |
| 477 | - 'return_value' => 'yes', | |
| 418 | + 'type' => Controls_Manager::SELECT, | |
| 478 | 419 | 'default' => 'yes', |
| 420 | + 'options' => [ | |
| 421 | + 'yes' => esc_html__( 'Yes', 'elementor' ), | |
| 422 | + 'no' => esc_html__( 'No', 'elementor' ), | |
| 423 | + ], | |
| 479 | 424 | 'condition' => [ |
| 480 | 425 | 'autoplay' => 'yes', |
| 481 | 426 | ], |
| 482 | 427 | 'frontend_available' => true, |
| @@ -501,13 +446,14 @@ | ||
| 501 | 446 | $this->add_control( |
| 502 | 447 | 'infinite', |
| 503 | 448 | [ |
| 504 | 449 | 'label' => esc_html__( 'Infinite Loop', 'elementor' ), |
| 505 | - 'type' => Controls_Manager::SWITCHER, | |
| 506 | - 'label_on' => esc_html__( 'Yes', 'elementor' ), | |
| 507 | - 'label_off' => esc_html__( 'No', 'elementor' ), | |
| 508 | - 'return_value' => 'yes', | |
| 450 | + 'type' => Controls_Manager::SELECT, | |
| 509 | 451 | 'default' => 'yes', |
| 452 | + 'options' => [ | |
| 453 | + 'yes' => esc_html__( 'Yes', 'elementor' ), | |
| 454 | + 'no' => esc_html__( 'No', 'elementor' ), | |
| 455 | + ], | |
| 510 | 456 | 'frontend_available' => true, |
| 511 | 457 | ] |
| 512 | 458 | ); |
| 513 | 459 | |
| @@ -593,17 +539,17 @@ | ||
| 593 | 539 | ], |
| 594 | 540 | ] |
| 595 | 541 | ); |
| 596 | 542 | |
| 597 | - $this->add_responsive_control( | |
| 543 | + $this->add_control( | |
| 598 | 544 | 'arrows_size', |
| 599 | 545 | [ |
| 600 | 546 | 'label' => esc_html__( 'Size', 'elementor' ), |
| 601 | 547 | 'type' => Controls_Manager::SLIDER, |
| 602 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 603 | 548 | 'range' => [ |
| 604 | 549 | 'px' => [ |
| 605 | - 'max' => 100, | |
| 550 | + 'min' => 20, | |
| 551 | + 'max' => 60, | |
| 606 | 552 | ], |
| 607 | 553 | ], |
| 608 | 554 | 'selectors' => [ |
| 609 | 555 | '{{WRAPPER}} .elementor-swiper-button.elementor-swiper-button-prev, {{WRAPPER}} .elementor-swiper-button.elementor-swiper-button-next' => 'font-size: {{SIZE}}{{UNIT}};', |
| @@ -657,37 +603,17 @@ | ||
| 657 | 603 | ], |
| 658 | 604 | ] |
| 659 | 605 | ); |
| 660 | 606 | |
| 661 | - $this->add_responsive_control( | |
| 662 | - 'dots_gap', | |
| 663 | - [ | |
| 664 | - 'label' => esc_html__( 'Space Between Dots', 'elementor' ), | |
| 665 | - 'type' => Controls_Manager::SLIDER, | |
| 666 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 667 | - 'range' => [ | |
| 668 | - 'px' => [ | |
| 669 | - 'max' => 20, | |
| 670 | - ], | |
| 671 | - ], | |
| 672 | - 'selectors' => [ | |
| 673 | - '{{WRAPPER}} .swiper-pagination-bullet' => '--swiper-pagination-bullet-horizontal-gap: {{SIZE}}{{UNIT}}; --swiper-pagination-bullet-vertical-gap: {{SIZE}}{{UNIT}};', | |
| 674 | - ], | |
| 675 | - 'condition' => [ | |
| 676 | - 'navigation' => [ 'dots', 'both' ], | |
| 677 | - ], | |
| 678 | - ] | |
| 679 | - ); | |
| 680 | - | |
| 681 | - $this->add_responsive_control( | |
| 607 | + $this->add_control( | |
| 682 | 608 | 'dots_size', |
| 683 | 609 | [ |
| 684 | 610 | 'label' => esc_html__( 'Size', 'elementor' ), |
| 685 | 611 | 'type' => Controls_Manager::SLIDER, |
| 686 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 687 | 612 | 'range' => [ |
| 688 | 613 | 'px' => [ |
| 689 | - 'max' => 20, | |
| 614 | + 'min' => 5, | |
| 615 | + 'max' => 10, | |
| 690 | 616 | ], |
| 691 | 617 | ], |
| 692 | 618 | 'selectors' => [ |
| 693 | 619 | '{{WRAPPER}} .swiper-pagination-bullet' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| @@ -785,9 +711,8 @@ | ||
| 785 | 711 | 'image_spacing_custom', |
| 786 | 712 | [ |
| 787 | 713 | 'label' => esc_html__( 'Image Spacing', 'elementor' ), |
| 788 | 714 | 'type' => Controls_Manager::SLIDER, |
| 789 | - 'size_units' => [ 'px' ], | |
| 790 | 715 | 'range' => [ |
| 791 | 716 | 'px' => [ |
| 792 | 717 | 'max' => 100, |
| 793 | 718 | ], |
| @@ -843,10 +768,10 @@ | ||
| 843 | 768 | [ |
| 844 | 769 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| 845 | 770 | 'type' => Controls_Manager::CHOOSE, |
| 846 | 771 | 'options' => [ |
| 847 | - 'start' => [ | |
| 848 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 772 | + 'left' => [ | |
| 773 | + 'title' => esc_html__( 'Left', 'elementor' ), | |
| 849 | 774 | 'icon' => 'eicon-text-align-left', |
| 850 | 775 | ], |
| 851 | 776 | 'center' => [ |
| 852 | 777 | 'title' => esc_html__( 'Center', 'elementor' ), |
| @@ -851,10 +776,10 @@ | ||
| 851 | 776 | 'center' => [ |
| 852 | 777 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 853 | 778 | 'icon' => 'eicon-text-align-center', |
| 854 | 779 | ], |
| 855 | - 'end' => [ | |
| 856 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 780 | + 'right' => [ | |
| 781 | + 'title' => esc_html__( 'Right', 'elementor' ), | |
| 857 | 782 | 'icon' => 'eicon-text-align-right', |
| 858 | 783 | ], |
| 859 | 784 | 'justify' => [ |
| 860 | 785 | 'title' => esc_html__( 'Justified', 'elementor' ), |
| @@ -860,13 +785,8 @@ | ||
| 860 | 785 | 'title' => esc_html__( 'Justified', 'elementor' ), |
| 861 | 786 | 'icon' => 'eicon-text-align-justify', |
| 862 | 787 | ], |
| 863 | 788 | ], |
| 864 | - 'classes' => 'elementor-control-start-end', | |
| 865 | - 'selectors_dictionary' => [ | |
| 866 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 867 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 868 | - ], | |
| 869 | 789 | 'default' => 'center', |
| 870 | 790 | 'selectors' => [ |
| 871 | 791 | '{{WRAPPER}} .elementor-image-carousel-caption' => 'text-align: {{VALUE}};', |
| 872 | 792 | ], |
| @@ -903,21 +823,10 @@ | ||
| 903 | 823 | 'selector' => '{{WRAPPER}} .elementor-image-carousel-caption', |
| 904 | 824 | ] |
| 905 | 825 | ); |
| 906 | 826 | |
| 907 | - $this->add_responsive_control( | |
| 908 | - 'caption_space', | |
| 909 | - [ | |
| 910 | - 'label' => esc_html__( 'Spacing', 'elementor' ), | |
| 911 | - 'type' => Controls_Manager::SLIDER, | |
| 912 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], | |
| 913 | - 'selectors' => [ | |
| 914 | - '{{WRAPPER}} .elementor-image-carousel-caption' => 'margin-block-start: {{SIZE}}{{UNIT}};', | |
| 915 | - ], | |
| 916 | - ] | |
| 917 | - ); | |
| 827 | + $this->end_controls_section(); | |
| 918 | 828 | |
| 919 | - $this->end_controls_section(); | |
| 920 | 829 | } |
| 921 | 830 | |
| 922 | 831 | /** |
| 923 | 832 | * Render image carousel widget output on the frontend. |
| @@ -972,25 +881,10 @@ | ||
| 972 | 881 | } |
| 973 | 882 | |
| 974 | 883 | $image_caption = $this->get_image_caption( $attachment ); |
| 975 | 884 | |
| 976 | - $slide_count = $index + 1; | |
| 977 | - $slide_setting_key = 'swiper_slide_' . $index; | |
| 885 | + $slide_html = '<div class="swiper-slide">' . $link_tag . '<figure class="swiper-slide-inner">' . $image_html; | |
| 978 | 886 | |
| 979 | - $this->add_render_attribute( $slide_setting_key, [ | |
| 980 | - 'class' => 'swiper-slide', | |
| 981 | - 'role' => 'group', | |
| 982 | - 'aria-roledescription' => 'slide', | |
| 983 | - 'aria-label' => sprintf( | |
| 984 | - /* translators: 1: Slide count, 2: Total slides count. */ | |
| 985 | - esc_html__( '%1$s of %2$s', 'elementor' ), | |
| 986 | - $slide_count, | |
| 987 | - count( $settings['carousel'] ) | |
| 988 | - ), | |
| 989 | - ] ); | |
| 990 | - | |
| 991 | - $slide_html = '<div ' . $this->get_render_attribute_string( $slide_setting_key ) . '>' . $link_tag . '<figure class="swiper-slide-inner">' . $image_html; | |
| 992 | - | |
| 993 | 887 | if ( $lazyload ) { |
| 994 | 888 | $slide_html .= '<div class="swiper-lazy-preloader"></div>'; |
| 995 | 889 | } |
| 996 | 890 | |
| @@ -1013,21 +907,16 @@ | ||
| 1013 | 907 | if ( empty( $slides ) ) { |
| 1014 | 908 | return; |
| 1015 | 909 | } |
| 1016 | 910 | |
| 1017 | - $swiper_class = 'swiper'; | |
| 1018 | - $has_autoplay_enabled = 'yes' === $this->get_settings_for_display( 'autoplay' ); | |
| 911 | + $swiper_class = Plugin::$instance->experiments->is_feature_active( 'e_swiper_latest' ) ? 'swiper' : 'swiper-container'; | |
| 1019 | 912 | |
| 1020 | 913 | $this->add_render_attribute( [ |
| 1021 | 914 | 'carousel' => [ |
| 1022 | 915 | 'class' => 'elementor-image-carousel swiper-wrapper', |
| 1023 | - 'aria-live' => $has_autoplay_enabled ? 'off' : 'polite', | |
| 1024 | 916 | ], |
| 1025 | 917 | 'carousel-wrapper' => [ |
| 1026 | 918 | 'class' => 'elementor-image-carousel-wrapper ' . $swiper_class, |
| 1027 | - 'role' => 'region', | |
| 1028 | - 'aria-roledescription' => 'carousel', | |
| 1029 | - 'aria-label' => $settings['carousel_name'], | |
| 1030 | 919 | 'dir' => $settings['direction'], |
| 1031 | 920 | ], |
| 1032 | 921 | ] ); |
| 1033 | 922 | |
| @@ -1038,27 +927,29 @@ | ||
| 1038 | 927 | $this->add_render_attribute( 'carousel', 'class', 'swiper-image-stretch' ); |
| 1039 | 928 | } |
| 1040 | 929 | |
| 1041 | 930 | $slides_count = count( $settings['carousel'] ); |
| 931 | + | |
| 1042 | 932 | ?> |
| 1043 | 933 | <div <?php $this->print_render_attribute_string( 'carousel-wrapper' ); ?>> |
| 1044 | 934 | <div <?php $this->print_render_attribute_string( 'carousel' ); ?>> |
| 1045 | - <?php // PHPCS - $slides contains the slides content, all the relevant content is escaped above. ?> | |
| 935 | + <?php // PHPCS - $slides contains the slides content, all the relevent content is escaped above. ?> | |
| 1046 | 936 | <?php echo implode( '', $slides ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 1047 | 937 | </div> |
| 1048 | 938 | <?php if ( 1 < $slides_count ) : ?> |
| 939 | + <?php if ( $show_dots ) : ?> | |
| 940 | + <div class="swiper-pagination"></div> | |
| 941 | + <?php endif; ?> | |
| 1049 | 942 | <?php if ( $show_arrows ) : ?> |
| 1050 | 943 | <div class="elementor-swiper-button elementor-swiper-button-prev" role="button" tabindex="0"> |
| 1051 | 944 | <?php $this->render_swiper_button( 'previous' ); ?> |
| 945 | + <span class="elementor-screen-only"><?php echo esc_html__( 'Previous image', 'elementor' ); ?></span> | |
| 1052 | 946 | </div> |
| 1053 | 947 | <div class="elementor-swiper-button elementor-swiper-button-next" role="button" tabindex="0"> |
| 1054 | 948 | <?php $this->render_swiper_button( 'next' ); ?> |
| 949 | + <span class="elementor-screen-only"><?php echo esc_html__( 'Next image', 'elementor' ); ?></span> | |
| 1055 | 950 | </div> |
| 1056 | 951 | <?php endif; ?> |
| 1057 | - | |
| 1058 | - <?php if ( $show_dots ) : ?> | |
| 1059 | - <div class="swiper-pagination"></div> | |
| 1060 | - <?php endif; ?> | |
| 1061 | 952 | <?php endif; ?> |
| 1062 | 953 | </div> |
| 1063 | 954 | <?php |
| 1064 | 955 | } |
| @@ -1068,9 +959,9 @@ | ||
| 1068 | 959 | * |
| 1069 | 960 | * @since 1.0.0 |
| 1070 | 961 | * @access private |
| 1071 | 962 | * |
| 1072 | - * @param array $attachment | |
| 963 | + * @param array $attachment | |
| 1073 | 964 | * @param object $instance |
| 1074 | 965 | * |
| 1075 | 966 | * @return array|string|false An array/string containing the attachment URL, or false if no link. |
| 1076 | 967 | */ |
| @@ -1110,12 +1001,8 @@ | ||
| 1110 | 1001 | } |
| 1111 | 1002 | |
| 1112 | 1003 | $attachment_post = get_post( $attachment['id'] ); |
| 1113 | 1004 | |
| 1114 | - if ( Utils::has_invalid_post_permissions( $attachment_post ) ) { | |
| 1115 | - return ''; | |
| 1116 | - } | |
| 1117 | - | |
| 1118 | 1005 | if ( 'caption' === $caption_type ) { |
| 1119 | 1006 | return $attachment_post->post_excerpt; |
| 1120 | 1007 | } |
| 1121 | 1008 | |
| @@ -1122,12 +1009,8 @@ | ||
| 1122 | 1009 | if ( 'title' === $caption_type ) { |
| 1123 | 1010 | return $attachment_post->post_title; |
| 1124 | 1011 | } |
| 1125 | 1012 | |
| 1126 | - if ( empty( $attachment_post->post_content ) ) { | |
| 1127 | - return ''; | |
| 1128 | - } | |
| 1129 | - | |
| 1130 | 1013 | return $attachment_post->post_content; |
| 1131 | 1014 | } |
| 1132 | 1015 | |
| 1133 | 1016 | private function render_swiper_button( $type ) { |
| @@ -1141,26 +1024,6 @@ | ||
| 1141 | 1024 | ]; |
| 1142 | 1025 | } |
| 1143 | 1026 | |
| 1144 | 1027 | Icons_Manager::render_icon( $icon_settings, [ 'aria-hidden' => 'true' ] ); |
| 1145 | - } | |
| 1146 | - | |
| 1147 | - public function render_markdown(): string { | |
| 1148 | - $settings = $this->get_settings_for_display(); | |
| 1149 | - if ( empty( $settings['carousel'] ) ) { | |
| 1150 | - return ''; | |
| 1151 | - } | |
| 1152 | - $images = []; | |
| 1153 | - foreach ( $settings['carousel'] as $item ) { | |
| 1154 | - $url = $item['url'] ?? ''; | |
| 1155 | - if ( empty( $url ) ) { | |
| 1156 | - continue; | |
| 1157 | - } | |
| 1158 | - $alt = ''; | |
| 1159 | - if ( ! empty( $item['id'] ) ) { | |
| 1160 | - $alt = get_post_meta( $item['id'], '_wp_attachment_image_alt', true ); | |
| 1161 | - } | |
| 1162 | - $images[] = ' . ')'; | |
| 1163 | - } | |
| 1164 | - return implode( "\n\n", $images ); | |
| 1165 | 1028 | } |
| 1166 | 1029 | } |