WooCommerce Code Reference

Content_Renderer
in package

Class Content_Renderer

Table of Contents

CONTENT_STYLES_FILE  = 'content.css'
$backup_post  : WP_Post|null
Property to store the backup of the current post.
$backup_query  : WP_Query|null
Property to store the backup of the current query.
$backup_template_content  : string|null
Property to store the backup of the current template content.
$backup_template_id  : int|null
Property to store the backup of the current template ID.
$block_type_registry  : WP_Block_Type_Registry
WordPress Block Type Registry.
$css_inliner  : Css_Inliner
CSS inliner
$fallback_renderer  : Fallback
Fallback renderer that is used when render_email_callback is not set for the rendered blockType.
$logger  : Email_Editor_Logger
Logger instance.
$process_manager  : Process_Manager
Process manager
$theme_controller  : Theme_Controller
Theme controller
__construct()  : mixed
Content_Renderer constructor.
block_parser()  : string
Get block parser class
preprocess_parsed_blocks()  : array<string|int, mixed>
Preprocess parsed blocks
render()  : string
Render the content
render_block()  : string
Renders block Translates block's HTML to HTML suitable for email clients. The method is intended as a callback for 'render_block' filter.
initialize()  : void
Initialize the content renderer
inline_styles()  : string
Method to inline styles into the HTML
reset()  : void
As we use default WordPress filters, we need to remove them after email rendering so that we don't interfere with possible post rendering that might happen later.
set_template_globals()  : void
Set template globals

Constants

Properties

Methods

__construct()

Content_Renderer constructor.

public __construct(Process_Manager $preprocess_manager, Css_Inliner $css_inliner, Theme_Controller $theme_controller, Email_Editor_Logger $logger) : mixed
Parameters
$preprocess_manager : Process_Manager

Preprocess manager.

$css_inliner : Css_Inliner

Css inliner.

$theme_controller : Theme_Controller

Theme controller.

$logger : Email_Editor_Logger

Logger instance.

Return values
mixed

render_block()

Renders block Translates block's HTML to HTML suitable for email clients. The method is intended as a callback for 'render_block' filter.

public render_block(string $block_content, array<string|int, mixed> $parsed_block) : string
Parameters
$block_content : string

Block content.

$parsed_block : array<string|int, mixed>

Parsed block.

Return values
string