Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks
Video::render_content
Renders the video block content by transforming it into a cover block structure. Shows the video poster/thumbnail with a play button overlay using the parent cover renderer.
Method of the class: Video{}
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.
Video::render_content() Video::render content code WC 10.5.0
protected function render_content( string $block_content, array $parsed_block, Rendering_Context $rendering_context ): string {
$block_attrs = $parsed_block['attrs'] ?? array();
// Extract poster URL from video attributes.
$poster_url = $this->extract_poster_url( $block_attrs, $block_content );
// If no poster image, return empty content.
if ( empty( $poster_url ) ) {
return '';
}
// Transform video block into cover block structure and delegate to parent.
$cover_block = $this->transform_to_cover_block( $parsed_block, $poster_url );
return parent::render_content( $block_content, $cover_block, $rendering_context );
}