| @@ -143,5 +143,21 @@ | ||
| 143 | 143 | */ |
| 144 | 144 | protected function render() { |
| 145 | 145 | $this->render_button(); |
| 146 | 146 | } |
| 147 | + | |
| 148 | + public function render_markdown(): string { | |
| 149 | + $settings = $this->get_settings_for_display(); | |
| 150 | + | |
| 151 | + $text = Utils::html_to_plain_text( $settings['text'] ?? '' ); | |
| 152 | + | |
| 153 | + if ( empty( $text ) ) { | |
| 154 | + return ''; | |
| 155 | + } | |
| 156 | + | |
| 157 | + if ( ! empty( $settings['link']['url'] ) ) { | |
| 158 | + return '[' . $text . '](' . esc_url( $settings['link']['url'] ) . ')'; | |
| 159 | + } | |
| 160 | + | |
| 161 | + return '**' . $text . '**'; | |
| 162 | + } | |
| 147 | 163 | } |