Automattic\WooCommerce\EmailEditor\Engine\Renderer
Renderer::render_text_version
Renders the text version of the email template.
Метод класса: Renderer{}
Хуков нет.
Возвращает
Строку.
Использование
// private - только в коде основоного (родительского) класса $result = $this->render_text_version( $template );
- $template(строка) (обязательный)
- HTML template.
Код Renderer::render_text_version() Renderer::render text version WC 10.5.2
private function render_text_version( $template ) {
$template = ( mb_detect_encoding( $template, 'UTF-8', true ) ) ? $template : mb_convert_encoding( $template, 'UTF-8', mb_list_encodings() );
// Ensure template is a string before processing.
if ( ! is_string( $template ) ) {
return '';
}
// Preserve personalization tags by temporarily replacing them with unique placeholders.
$template = $this->preserve_personalization_tags( $template );
$result = Html2Text::convert( (string) $template, array( 'ignore_errors' => true ) );
if ( ! $result ) {
return '';
}
// Restore personalization tags from placeholders.
$result = $this->restore_personalization_tags( $result );
return $result;
}