wp_add_parent_layout_to_parsed_block()
Check if the parent block exists and if it has a layout attribute. If it does, add the parent layout to the parsed block
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Returns
Array
. The parsed block with parent layout attribute if it exists.
Usage
wp_add_parent_layout_to_parsed_block( $parsed_block, $source_block, $parent_block );
- $parsed_block(array) (required)
- The parsed block.
- $source_block(array) (required)
- The source block.
- $parent_block(WP_Block) (required)
- The parent block.
Changelog
Since 6.6.0 | Introduced. |
wp_add_parent_layout_to_parsed_block() wp add parent layout to parsed block code WP 6.8.1
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; }