Quote
extends Abstract_Block_Renderer
in package
Renders a quote block.
Table of Contents
- $current_rendering_context : Rendering_Context|null
- Rendering context for calls using the legacy add_spacer() signature.
- render() : string
- Render the block.
- add_spacer() : string
- Add a spacer around the block for vertical spacing (margin-top).
- add_spacer_with_context() : string
- Add a spacer around the block with rendering context.
- compile_css() : string
- Compile objects containing CSS properties to a string.
- get_inner_content() : string
- Extract inner content from a wrapper element.
- 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
- get_authored_alignment() : string|null
- Get explicit quote alignment when authored.
- get_block_wrapper() : string
- Returns the block wrapper.
- get_citation_wrapper() : string
- Returns the citation content with a wrapper.
- has_authored_border() : bool
- Check whether quote border was explicitly authored.
Properties
$current_rendering_context
Rendering context for calls using the legacy add_spacer() signature.
protected
Rendering_Context|null
$current_rendering_context
= null
Methods
render()
Render the block.
public
render(string $block_content, array<string|int, mixed> $parsed_block, Rendering_Context $rendering_context) : string
Parameters
- $block_content : string
-
The block content.
- $parsed_block : array<string|int, mixed>
-
The parsed block.
- $rendering_context : Rendering_Context
-
The rendering context.
Return values
string —add_spacer()
Add a spacer around the block for vertical spacing (margin-top).
protected
add_spacer(string $content, array<string|int, mixed> $email_attrs) : string
Horizontal root padding is applied uniformly by Content_Renderer::render_block() so that all blocks — including those using render_email_callback without Abstract_Block_Renderer — receive consistent padding.
Parameters
- $content : string
-
The block content.
- $email_attrs : array<string|int, mixed>
-
The email attributes.
Return values
string —add_spacer_with_context()
Add a spacer around the block with rendering context.
protected
add_spacer_with_context(string $content, array<string|int, mixed> $email_attrs[, Rendering_Context|null $rendering_context = null ]) : string
Parameters
- $content : string
-
The block content.
- $email_attrs : array<string|int, mixed>
-
The email attributes.
- $rendering_context : Rendering_Context|null = null
-
Rendering context.
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_inner_content()
Extract inner content from a wrapper element.
protected
get_inner_content(string $block_content[, string $tag_name = 'div' ]) : string
Removes the outer wrapper element (e.g., div) and returns only the inner HTML content. This is useful when you need to strip the wrapper and use only the inner content.
Parameters
- $block_content : string
-
Block content with wrapper element.
- $tag_name : string = 'div'
-
Tag name of the wrapper element (default: 'div').
Return values
string — Inner content without the wrapper element, or original content if wrapper not found.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, Rendering_Context $rendering_context) : string
Parameters
- $block_content : string
-
Block content.
- $parsed_block : array<string|int, mixed>
-
Parsed block.
- $rendering_context : Rendering_Context
-
Rendering context.
Return values
string —get_authored_alignment()
Get explicit quote alignment when authored.
private
get_authored_alignment(array<string|int, mixed> $block_attributes, string $original_classname) : string|null
Parameters
- $block_attributes : array<string|int, mixed>
-
Block attributes.
- $original_classname : string
-
Original quote classes.
Return values
string|null —get_block_wrapper()
Returns the block wrapper.
private
get_block_wrapper(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.
- $rendering_context : Rendering_Context
-
Rendering context.
Return values
string —get_citation_wrapper()
Returns the citation content with a wrapper.
private
get_citation_wrapper(string $citation_content, array<string|int, mixed> $parsed_block, Rendering_Context $rendering_context) : string
Parameters
- $citation_content : string
-
The citation text.
- $parsed_block : array<string|int, mixed>
-
Parsed block.
- $rendering_context : Rendering_Context
-
Rendering context instance.
Return values
string — The wrapped citation HTML or empty string if no citation.has_authored_border()
Check whether quote border was explicitly authored.
private
has_authored_border(array<string|int, mixed> $block_attributes) : bool
Parameters
- $block_attributes : array<string|int, mixed>
-
Block attributes.
