| @@ -8,8 +8,9 @@ | ||
| 8 | 8 | /** |
| 9 | 9 | * Elementor HTML widget. |
| 10 | 10 | * |
| 11 | 11 | * Elementor widget that insert a custom HTML code into the page. |
| 12 | + * | |
| 12 | 13 | */ |
| 13 | 14 | class Widget_Read_More extends Widget_Base { |
| 14 | 15 | |
| 15 | 16 | /** |
| @@ -67,16 +68,8 @@ | ||
| 67 | 68 | public function get_keywords() { |
| 68 | 69 | return [ 'read', 'more', 'tag', 'excerpt' ]; |
| 69 | 70 | } |
| 70 | 71 | |
| 71 | - protected function is_dynamic_content(): bool { | |
| 72 | - return false; | |
| 73 | - } | |
| 74 | - | |
| 75 | - public function has_widget_inner_wrapper(): bool { | |
| 76 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 77 | - } | |
| 78 | - | |
| 79 | 72 | /** |
| 80 | 73 | * Register HTML widget controls. |
| 81 | 74 | * |
| 82 | 75 | * Adds different input fields to allow the user to change and customize the widget settings. |
| @@ -91,31 +84,16 @@ | ||
| 91 | 84 | 'label' => esc_html__( 'Read More', 'elementor' ), |
| 92 | 85 | ] |
| 93 | 86 | ); |
| 94 | 87 | |
| 95 | - $default_link_text = esc_html__( 'Continue reading', 'elementor' ); | |
| 88 | + $default_link_text = apply_filters( 'elementor/widgets/read_more/default_link_text', esc_html__( 'Continue reading', 'elementor' ) ); | |
| 96 | 89 | |
| 97 | - /** | |
| 98 | - * Read More widgets link text. | |
| 99 | - * | |
| 100 | - * Filters the link text in the "Read More" widget. | |
| 101 | - * | |
| 102 | - * This hook can be used to set different default text in the widget. | |
| 103 | - * | |
| 104 | - * @param string $default_link_text The link text in the "Read More" widget. Default is "Continue reading". | |
| 105 | - */ | |
| 106 | - $default_link_text = apply_filters( 'elementor/widgets/read_more/default_link_text', $default_link_text ); | |
| 107 | - | |
| 108 | 90 | $this->add_control( |
| 109 | 91 | 'theme_support', |
| 110 | 92 | [ |
| 111 | - 'type' => Controls_Manager::ALERT, | |
| 112 | - 'alert_type' => 'warning', | |
| 113 | - 'content' => sprintf( | |
| 114 | - /* translators: %s: The `the_content` function. */ | |
| 115 | - esc_html__( 'Note: This widget only affects themes that use `%s` in archive pages.', 'elementor' ), | |
| 116 | - 'the_content' | |
| 117 | - ), | |
| 93 | + 'type' => Controls_Manager::RAW_HTML, | |
| 94 | + 'raw' => sprintf( esc_html__( 'Note: This widget only affects themes that use `%s` in archive pages.', 'elementor' ), 'the_content' ), | |
| 95 | + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', | |
| 118 | 96 | ] |
| 119 | 97 | ); |
| 120 | 98 | |
| 121 | 99 | $this->add_control( |
| @@ -123,11 +101,8 @@ | ||
| 123 | 101 | [ |
| 124 | 102 | 'label' => esc_html__( 'Read More Text', 'elementor' ), |
| 125 | 103 | 'placeholder' => $default_link_text, |
| 126 | 104 | 'default' => $default_link_text, |
| 127 | - 'dynamic' => [ | |
| 128 | - 'active' => true, | |
| 129 | - ], | |
| 130 | 105 | ] |
| 131 | 106 | ); |
| 132 | 107 | |
| 133 | 108 | $this->end_controls_section(); |
| @@ -155,16 +130,6 @@ | ||
| 155 | 130 | protected function content_template() { |
| 156 | 131 | ?> |
| 157 | 132 | <!--more {{ settings.link_text }}--> |
| 158 | 133 | <?php |
| 159 | - } | |
| 160 | - | |
| 161 | - public function render_markdown(): string { | |
| 162 | - $settings = $this->get_settings_for_display(); | |
| 163 | - $text = Utils::html_to_plain_text( $settings['link_text'] ?? 'Read More' ); | |
| 164 | - $url = ( $settings['link'] ?? [] )['url'] ?? ''; | |
| 165 | - if ( ! empty( $url ) ) { | |
| 166 | - return '[' . $text . '](' . esc_url( $url ) . ')'; | |
| 167 | - } | |
| 168 | - return $text; | |
| 169 | 134 | } |
| 170 | 135 | } |