wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_add_parent_layout_to_parsed_block › WordPress Function

Since6.6.0
Deprecatedn/a
wp_add_parent_layout_to_parsed_block ( $parsed_block, $source_block, $parent_block )
Access:
  • private
Parameters: (3)
  • (array) $parsed_block The parsed block.
    Required: Yes
  • (array) $source_block The source block.
    Required: Yes
  • (WP_Block) $parent_block The parent block.
    Required: Yes
Returns:
  • (array) The parsed block with parent layout attribute if it exists.
Defined at:
Codex:

Check if the parent block exists and if it has a layout attribute.

If it does, add the parent layout to the parsed block


Source

function wp_add_parent_layout_to_parsed_block( $parsed_block, $source_block, $parent_block ) {
	if ( $parent_block && isset( $parent_block->parsed_block['attrs']['layout'] ) ) {
		$parsed_block['parentLayout'] = $parent_block->parsed_block['attrs']['layout'];
	}
	return $parsed_block;
}