| @@ -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 | /** |
| @@ -36,9 +37,9 @@ | ||
| 36 | 37 | * |
| 37 | 38 | * @return string Widget title. |
| 38 | 39 | */ |
| 39 | 40 | public function get_title() { |
| 40 | - return esc_html__( 'Read More', 'elementor' ); | |
| 41 | + return __( 'Read More', 'elementor' ); | |
| 41 | 42 | } |
| 42 | 43 | |
| 43 | 44 | /** |
| 44 | 45 | * Get widget icon. |
| @@ -67,55 +68,31 @@ | ||
| 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. |
| 83 | 76 | * |
| 84 | - * @since 3.1.0 | |
| 85 | 77 | * @access protected |
| 86 | 78 | */ |
| 87 | - protected function register_controls() { | |
| 79 | + protected function _register_controls() { | |
| 88 | 80 | $this->start_controls_section( |
| 89 | 81 | 'section_title', |
| 90 | 82 | [ |
| 91 | - 'label' => esc_html__( 'Read More', 'elementor' ), | |
| 83 | + 'label' => __( 'Read More', 'elementor' ), | |
| 92 | 84 | ] |
| 93 | 85 | ); |
| 94 | 86 | |
| 95 | - $default_link_text = esc_html__( 'Continue reading', 'elementor' ); | |
| 87 | + $default_link_text = apply_filters( 'elementor/widgets/read_more/default_link_text', __( 'Continue reading', 'elementor' ) ); | |
| 96 | 88 | |
| 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 | 89 | $this->add_control( |
| 109 | 90 | 'theme_support', |
| 110 | 91 | [ |
| 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 | - ), | |
| 92 | + 'type' => Controls_Manager::RAW_HTML, | |
| 93 | + 'raw' => sprintf( __( 'Note: This widget only affects themes that use `%s` in archive pages.', 'elementor' ), 'the_content' ), | |
| 94 | + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', | |
| 118 | 95 | ] |
| 119 | 96 | ); |
| 120 | 97 | |
| 121 | 98 | $this->add_control( |
| @@ -120,14 +97,11 @@ | ||
| 120 | 97 | |
| 121 | 98 | $this->add_control( |
| 122 | 99 | 'link_text', |
| 123 | 100 | [ |
| 124 | - 'label' => esc_html__( 'Read More Text', 'elementor' ), | |
| 101 | + 'label' => __( 'Read More Text', 'elementor' ), | |
| 125 | 102 | 'placeholder' => $default_link_text, |
| 126 | 103 | 'default' => $default_link_text, |
| 127 | - 'dynamic' => [ | |
| 128 | - 'active' => true, | |
| 129 | - ], | |
| 130 | 104 | ] |
| 131 | 105 | ); |
| 132 | 106 | |
| 133 | 107 | $this->end_controls_section(); |
| @@ -140,9 +114,9 @@ | ||
| 140 | 114 | * |
| 141 | 115 | * @access protected |
| 142 | 116 | */ |
| 143 | 117 | protected function render() { |
| 144 | - printf( '<!--more %s-->', wp_kses_post( $this->get_settings_for_display( 'link_text' ) ) ); | |
| 118 | + printf( '<!--more %s-->', $this->get_settings_for_display( 'link_text' ) ); | |
| 145 | 119 | } |
| 146 | 120 | |
| 147 | 121 | /** |
| 148 | 122 | * Render Read More widget output in the editor. |
| @@ -155,16 +129,6 @@ | ||
| 155 | 129 | protected function content_template() { |
| 156 | 130 | ?> |
| 157 | 131 | <!--more {{ settings.link_text }}--> |
| 158 | 132 | <?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 | 133 | } |
| 170 | 134 | } |