| @@ -1,7 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | +use Elementor\Core\Frontend\Widget_Content_Render_Mode; | |
| 4 | 5 | use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager; |
| 5 | 6 | use Elementor\Utils; |
| 6 | 7 | |
| 7 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -379,9 +380,9 @@ | ||
| 379 | 380 | 'categories' => $this->get_categories(), |
| 380 | 381 | 'html_wrapper_class' => $this->get_html_wrapper_class(), |
| 381 | 382 | 'show_in_panel' => $this->show_in_panel(), |
| 382 | 383 | 'hide_on_search' => $this->hide_on_search(), |
| 383 | - 'upsale_data' => Plugin::$instance->experiments->is_feature_active( 'e_panel_promotions' ) ? null : $this->get_upsale_data(), | |
| 384 | + 'upsale_data' => null, | |
| 384 | 385 | 'is_dynamic_content' => $this->is_dynamic_content(), |
| 385 | 386 | 'has_widget_inner_wrapper' => $this->has_widget_inner_wrapper(), |
| 386 | 387 | ]; |
| 387 | 388 | |
| @@ -623,9 +624,9 @@ | ||
| 623 | 624 | * @since 1.0.0 |
| 624 | 625 | * |
| 625 | 626 | * @param Widget_Base $this The current widget. |
| 626 | 627 | */ |
| 627 | - do_action( 'elementor/widget/before_render_content', $this ); | |
| 628 | + do_action( 'elementor/widget/before_render_content', $this, [ 'mode' => Widget_Content_Render_Mode::NORMAL ] ); | |
| 628 | 629 | |
| 629 | 630 | ob_start(); |
| 630 | 631 | |
| 631 | 632 | $skin = $this->get_current_skin(); |
| @@ -658,9 +659,9 @@ | ||
| 658 | 659 | * |
| 659 | 660 | * @param string $widget_content The content of the widget. |
| 660 | 661 | * @param Widget_Base $this The widget. |
| 661 | 662 | */ |
| 662 | - $widget_content = apply_filters( 'elementor/widget/render_content', $widget_content, $this ); | |
| 663 | + $widget_content = apply_filters( 'elementor/widget/render_content', $widget_content, $this, [ 'mode' => Widget_Content_Render_Mode::NORMAL ] ); | |
| 663 | 664 | Utils::print_unescaped_internal_string( $widget_content ); |
| 664 | 665 | ?> |
| 665 | 666 | <?php if ( $this->has_widget_inner_wrapper() ) : ?> |
| 666 | 667 | </div> |
| @@ -697,13 +698,40 @@ | ||
| 697 | 698 | $this->render_content(); |
| 698 | 699 | } |
| 699 | 700 | |
| 700 | 701 | public function render_markdown(): string { |
| 702 | + $content = $this->get_render_content_for_markdown(); | |
| 703 | + | |
| 704 | + if ( '' === $content ) { | |
| 705 | + return ''; | |
| 706 | + } | |
| 707 | + | |
| 708 | + return \Elementor\Modules\MarkdownRender\Html_To_Markdown::convert( $content ); | |
| 709 | + } | |
| 710 | + | |
| 711 | + protected function get_render_content_for_markdown(): string { | |
| 712 | + $render_args = [ 'mode' => Widget_Content_Render_Mode::MARKDOWN ]; | |
| 713 | + | |
| 714 | + do_action( 'elementor/widget/before_render_content', $this, $render_args ); | |
| 715 | + | |
| 701 | 716 | ob_start(); |
| 702 | - $this->render_content(); | |
| 703 | - $html = ob_get_clean(); | |
| 704 | 717 | |
| 705 | - return wp_strip_all_tags( $html ); | |
| 718 | + $skin = $this->get_current_skin(); | |
| 719 | + | |
| 720 | + if ( $skin ) { | |
| 721 | + $skin->set_parent( $this ); | |
| 722 | + $skin->render_by_mode(); | |
| 723 | + } else { | |
| 724 | + $this->render_by_mode(); | |
| 725 | + } | |
| 726 | + | |
| 727 | + $widget_content = ob_get_clean(); | |
| 728 | + | |
| 729 | + if ( '' === $widget_content ) { | |
| 730 | + return ''; | |
| 731 | + } | |
| 732 | + | |
| 733 | + return apply_filters( 'elementor/widget/render_content', $widget_content, $this, $render_args ); | |
| 706 | 734 | } |
| 707 | 735 | |
| 708 | 736 | /** |
| 709 | 737 | * Before widget rendering. |