WP_Block::refresh_parsed_block_dependents()
Updates the parsed block content for the current block and its inner blocks.
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.
Method of the class: WP_Block{}
No Hooks.
Returns
null
. Nothing (null).
Usage
$WP_Block = new WP_Block(); $WP_Block->refresh_parsed_block_dependents();
Changelog
Since 6.8.0 | Introduced. |
WP_Block::refresh_parsed_block_dependents() WP Block::refresh parsed block dependents code WP 6.8.1
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']; } }