mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Blocks: Introduce a variation of serialize blocks helper with traversing
Introduces two new functions `traverse_and_serialize_blocks` and `traverse_and_serialize_block` with the additional `$callback` argument. It is possible to pass parent block, block index, chunk index to the callback argument. Reverts changes applied to `serialize_blocks` and `serialize_block` in #59327 with [56557]. Props ockham, mukesh27. See #59313. git-svn-id: https://develop.svn.wordpress.org/trunk@56620 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -609,7 +609,7 @@ function _build_block_template_result_from_file( $template_file, $template_type
|
||||
}
|
||||
|
||||
$blocks = parse_blocks( $template_content );
|
||||
$template->content = serialize_blocks( $blocks, '_inject_theme_attribute_in_template_part_block' );
|
||||
$template->content = traverse_and_serialize_blocks( $blocks, '_inject_theme_attribute_in_template_part_block' );
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user