Automattic\WooCommerce\Blocks\BlockTypes

EmailContent::renderprotectedWC 1.0

Renders Woo content placeholder to be replaced by content during sending.

Method of the class: EmailContent{}

No Hooks.

Returns

String. Rendered block output.

Usage

// protected - for code of main (parent) or child class
$result = $this->render( $attributes, $content, $block );
$attributes(array) (required)
Block attributes.
$content(string) (required)
Block content.
$block(WP_Block) (required)
Block instance.

EmailContent::render() code WC 10.3.6

protected function render( $attributes, $content, $block ) {
	// phpcs:disable WordPress.Security.NonceVerification.Recommended
	if ( defined( 'REST_REQUEST' ) && REST_REQUEST && isset( $_GET['context'] ) && 'edit' === sanitize_text_field( wp_unslash( $_GET['context'] ) ) ) {
		// Block is being rendered for ServerSideRender editor preview.
		return $this->render_preview( $attributes );
	}

	return BlockEmailRenderer::WOO_EMAIL_CONTENT_PLACEHOLDER;
}