Automattic\WooCommerce\EmailEditor\Integrations\WooCommerce\Renderer\Blocks
Product_Image::render_content
Render the product image block content for email.
Method of the class: Product_Image{}
No Hooks.
Returns
String.
Usage
// protected - for code of main (parent) or child class $result = $this->render_content( $block_content, $parsed_block, $rendering_context ): string;
- $block_content(string) (required)
- Block content.
- $parsed_block(array) (required)
- Parsed block.
- $rendering_context(Rendering_Context) (required)
- Rendering context.
Product_Image::render_content() Product Image::render content code WC 10.4.3
protected function render_content( string $block_content, array $parsed_block, Rendering_Context $rendering_context ): string {
$product = $this->get_product_from_context( $parsed_block );
if ( ! $product ) {
return '';
}
$attributes = $this->parse_attributes( $parsed_block['attrs'] ?? array() );
$image_data = $this->get_product_image_data( $product, $attributes );
if ( ! $image_data ) {
return '';
}
$parsed_block = $this->add_image_size_when_missing( $parsed_block, $rendering_context );
$attributes = $this->parse_attributes( $parsed_block['attrs'] ?? array() );
$image_html = $this->build_image_html( $image_data, $attributes, $rendering_context );
$inner_blocks = $this->process_inner_blocks( $parsed_block, $product, $rendering_context );
$combined_content = $this->create_overlay_structure(
$image_html,
$inner_blocks['badges'],
$inner_blocks['other_content'],
$inner_blocks['badge_alignment'],
$product,
$attributes['showProductLink']
);
return $this->apply_email_wrapper( $combined_content, $parsed_block, $rendering_context );
}