Automattic\WooCommerce\EmailEditor\Engine
Send_Preview_Email::render_html
Renders the HTML content of the post
Method of the class: Send_Preview_Email{}
Hooks from the method
Returns
String.
Usage
$Send_Preview_Email = new Send_Preview_Email(); $Send_Preview_Email->render_html( $post ): string;
- $post(WP_Post) (required)
- The WordPress post object.
Send_Preview_Email::render_html() Send Preview Email::render html code WC 10.6.2
public function render_html( $post ): string {
$subject = $post->post_title;
$language = get_bloginfo( 'language' );
// Add filter to set preview context for block renderers.
add_filter( 'woocommerce_email_editor_rendering_email_context', array( $this, 'add_preview_context' ) );
$rendered_data = $this->renderer->render(
$post,
$subject,
__( 'Preview', 'woocommerce' ),
$language
);
// Remove filter after rendering.
remove_filter( 'woocommerce_email_editor_rendering_email_context', array( $this, 'add_preview_context' ) );
$rendered_data = apply_filters( 'woocommerce_email_editor_send_preview_email_rendered_data', $rendered_data, $post );
return $this->set_personalize_content( $rendered_data['html'] );
}