Fallback
extends Abstract_Block_Renderer
in package
Fallback block renderer.
This renderer is used when no specific renderer is found for a block.
AbstractBlockRenderer applies some adjustments to the block content, like adding spacers. By using fallback renderer for all blocks we apply there adjustments to all blocks that don't have any renderer.
We need to find a better abstraction/architecture for this.
Table of Contents
- render() : string
- Render the block.
- add_spacer() : string
- Add a spacer around the block.
- compile_css() : string
- Compile objects containing CSS properties to a string.
- get_styles_from_block() : array<string|int, mixed>
- Wrapper for wp_style_engine_get_styles which ensures all values are returned.
- render_content() : string
- Renders the block content.
Methods
render()
Render the block.
public
render(string $block_content, array<string|int, mixed> $parsed_block, Settings_Controller $settings_controller) : string
Parameters
- $block_content : string
-
The block content.
- $parsed_block : array<string|int, mixed>
-
The parsed block.
- $settings_controller : Settings_Controller
-
The settings controller.
Return values
string —add_spacer()
Add a spacer around the block.
protected
add_spacer(string $content, array<string|int, mixed> $email_attrs) : string
Parameters
- $content : string
-
The block content.
- $email_attrs : array<string|int, mixed>
-
The email attributes.
Return values
string —compile_css()
Compile objects containing CSS properties to a string.
protected
compile_css(array<string|int, mixed> ...$styles) : string
Parameters
- $styles : array<string|int, mixed>
-
Style arrays to compile.
Return values
string —get_styles_from_block()
Wrapper for wp_style_engine_get_styles which ensures all values are returned.
protected
get_styles_from_block(array<string|int, mixed> $block_styles[, bool $skip_convert_vars = false ]) : array<string|int, mixed>
Parameters
- $block_styles : array<string|int, mixed>
-
Array of block styles.
- $skip_convert_vars : bool = false
-
If true, --wp_preset--spacing--x type values will be left in the original var:preset:spacing:x format.
Return values
array<string|int, mixed> —render_content()
Renders the block content.
protected
render_content(string $block_content, array<string|int, mixed> $parsed_block, Settings_Controller $settings_controller) : string
Parameters
- $block_content : string
-
Block content.
- $parsed_block : array<string|int, mixed>
-
Parsed block.
- $settings_controller : Settings_Controller
-
Settings controller.