Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks
Gallery::render_content
Renders the gallery block content using a table-based layout.
Method of the class: Gallery{}
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.
Gallery::render_content() Gallery::render content code WC 10.5.0
protected function render_content( string $block_content, array $parsed_block, Rendering_Context $rendering_context ): string {
// Extract images directly from the block content (more efficient than re-rendering).
$gallery_images = $this->extract_images_from_gallery_content( $block_content, $parsed_block );
// If we don't have any images, return empty.
if ( empty( $gallery_images ) ) {
return '';
}
// Build the email-friendly layout.
return $this->build_email_layout( $gallery_images, $parsed_block, $block_content, $rendering_context );
}