Skip to content

Commit 7fda6f5

Browse files
committed
Add callback arg to serialize_blocks (plural)
1 parent f7465b9 commit 7fda6f5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/wp-includes/blocks.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,12 +828,18 @@ function serialize_block( $block, $callback = null ) {
828828
* parsed blocks.
829829
*
830830
* @since 5.3.1
831+
* @since 6.4.0 The `$callback` parameter was added.
831832
*
832833
* @param array[] $blocks An array of representative arrays of parsed block objects. See serialize_block().
834+
* @param string $callback Optional. Callback to run on the blocks before serialization.
833835
* @return string String of rendered HTML.
834836
*/
835-
function serialize_blocks( $blocks ) {
836-
return implode( '', array_map( 'serialize_block', $blocks ) );
837+
function serialize_blocks( $blocks, $callback = null ) {
838+
$result = '';
839+
foreach( $blocks as $block ) {
840+
$result .= serialize_block( $block, $callback );
841+
};
842+
return $result;
837843
}
838844

839845
/**

0 commit comments

Comments
 (0)