Initializer
in package
Initializes the core blocks renderers.
Table of Contents
- ALLOWED_BLOCK_TYPES = array('core/button', 'core/buttons', 'core/column', 'core/columns', 'core/group', 'core/heading', 'core/image', 'core/list', 'core/list-item', 'core/paragraph', 'core/quote', 'core/spacer', 'core/social-link', 'core/social-links')
- List of supported blocks in the email editor.
- $renderers : array<string|int, mixed>
- Cache renderers by block name.
- adjust_theme_json() : WP_Theme_JSON
- Adjusts the editor's theme to add blocks specific settings for core blocks.
- allow_styles() : array<string|int, mixed>
- Allow styles for the email editor.
- initialize() : void
- Initializes the core blocks renderers.
- 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 blocks in the email editor.
public
mixed
ALLOWED_BLOCK_TYPES
= array('core/button', 'core/buttons', 'core/column', 'core/columns', 'core/group', 'core/heading', 'core/image', 'core/list', 'core/list-item', 'core/paragraph', 'core/quote', 'core/spacer', 'core/social-link', 'core/social-links')
Properties
$renderers
Cache renderers by block name.
private
array<string|int, mixed>
$renderers
= array()
Methods
adjust_theme_json()
Adjusts the editor's theme to add blocks specific settings for core blocks.
public
adjust_theme_json(WP_Theme_JSON $editor_theme_json) : WP_Theme_JSON
Parameters
- $editor_theme_json : WP_Theme_JSON
-
Editor theme JSON.
Return values
WP_Theme_JSON —allow_styles()
Allow styles for the email editor.
public
allow_styles(array<string|int, mixed>|null $allowed_styles) : array<string|int, mixed>
Parameters
- $allowed_styles : array<string|int, mixed>|null
-
Allowed styles.
Return values
array<string|int, mixed> —initialize()
Initializes the core blocks renderers.
public
initialize() : void
Return values
void —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.