Skip to content

Commit

Permalink
Add callback arg to serialize_blocks (plural)
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Sep 7, 2023
1 parent f7465b9 commit 7fda6f5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -828,12 +828,18 @@ function serialize_block( $block, $callback = null ) {
* parsed blocks.
*
* @since 5.3.1
* @since 6.4.0 The `$callback` parameter was added.
*
* @param array[] $blocks An array of representative arrays of parsed block objects. See serialize_block().
* @param string $callback Optional. Callback to run on the blocks before serialization.
* @return string String of rendered HTML.
*/
function serialize_blocks( $blocks ) {
return implode( '', array_map( 'serialize_block', $blocks ) );
function serialize_blocks( $blocks, $callback = null ) {
$result = '';
foreach( $blocks as $block ) {
$result .= serialize_block( $block, $callback );
};
return $result;
}

/**
Expand Down

0 comments on commit 7fda6f5

Please sign in to comment.