Initializer
in package
Initializes the WooCommerce blocks renderers.
Table of Contents
- ALLOWED_BLOCK_TYPES = array('woocommerce/product-collection', 'woocommerce/product-image', 'woocommerce/product-price', 'woocommerce/product-button', 'woocommerce/product-sale-badge')
- List of supported WooCommerce blocks in the email editor.
- $renderers : array<string|int, mixed>
- Cache renderers by block name.
- render_block() : string
- Returns the block content rendered by the block renderer.
- update_block_settings() : array<string|int, mixed>
- Set `supports.email = true` and configure render_email_callback for supported blocks.
- get_block_renderer() : Abstract_Block_Renderer
- Return an instance of Abstract_Block_Renderer by the block name.
Constants
ALLOWED_BLOCK_TYPES
List of supported WooCommerce blocks in the email editor.
public
mixed
ALLOWED_BLOCK_TYPES
= array('woocommerce/product-collection', 'woocommerce/product-image', 'woocommerce/product-price', 'woocommerce/product-button', 'woocommerce/product-sale-badge')
Properties
$renderers
Cache renderers by block name.
private
array<string|int, mixed>
$renderers
= array()
Methods
render_block()
Returns the block content rendered by the block renderer.
public
render_block(string $block_content, array<string|int, mixed> $parsed_block, Rendering_Context $rendering_context) : string
Parameters
- $block_content : string
-
Block content.
- $parsed_block : array<string|int, mixed>
-
Parsed block settings.
- $rendering_context : Rendering_Context
-
Rendering context.
Return values
string —update_block_settings()
Set `supports.email = true` and configure render_email_callback for supported blocks.
public
update_block_settings(array<string|int, mixed> $settings) : array<string|int, mixed>
Parameters
- $settings : array<string|int, mixed>
-
Block settings.
Return values
array<string|int, mixed> —get_block_renderer()
Return an instance of Abstract_Block_Renderer by the block name.
private
get_block_renderer(string $block_name) : Abstract_Block_Renderer
Parameters
- $block_name : string
-
Block name.
