Updates the parsed block content for the current block and its inner blocks.
Description
This method sets the inner_html and inner_content properties of the block based on the parsed block content provided during initialization. It ensures that the block instance reflects the most up-to-date content for both the inner HTML and any string fragments around inner blocks.
If the block has inner blocks, this method initializes a new WP_Block_List for them, ensuring the correct content and context are updated for each nested block.
Source
public function refresh_parsed_block_dependents() {
if ( ! empty( $this->parsed_block['innerBlocks'] ) ) {
$child_context = $this->available_context;
if ( ! empty( $this->block_type->provides_context ) ) {
foreach ( $this->block_type->provides_context as $context_name => $attribute_name ) {
if ( array_key_exists( $attribute_name, $this->attributes ) ) {
$child_context[ $context_name ] = $this->attributes[ $attribute_name ];
}
}
}
$this->inner_blocks = new WP_Block_List( $this->parsed_block['innerBlocks'], $child_context, $this->registry );
}
if ( ! empty( $this->parsed_block['innerHTML'] ) ) {
$this->inner_html = $this->parsed_block['innerHTML'];
}
if ( ! empty( $this->parsed_block['innerContent'] ) ) {
$this->inner_content = $this->parsed_block['innerContent'];
}
}
Changelog
| Version | Description |
|---|---|
| 6.8.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.