wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_add_parent_layout_to_parsed_block › WordPress Function

Since6.6.0
已弃用n/a
› wp_add_parent_layout_to_parsed_block ( $parsed_block, $source_block, $parent_block )
访问:
  • private
参数: (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
返回:
  • (array) The parsed block with parent layout attribute if it exists.
定义在:
文档:

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

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


源码

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;
}