Blocks: Change traverse_and_serialize_block(s)'s callback signature.

During work on #59399, it was discovered that ''sibling'' block insertion wasn't likely going to work the way it was planned, which required devising an alternative solution. This new solution requires some changes to `traverse_and_serialize_block(s)`:

- Change the signature of the existing callback such that:
  - the return value is a string that will be prepended to the result of the inner block traversal and serialization;
  - the function arguments are: a ''reference'' to the current block (so it can be modified inline, which is important e.g. for `theme` attribute insertion), the parent block, and the previous block (instead of the block index and chunk index).
- Add a second callback argument to `traverse_and_serialize_block(s)`, which is called ''after'' the block is traversed and serialized.
  - Its function arguments are a reference to the current block, the parent block, and the next block.

Props gziolo.
Fixes #59412. See #59313.
Built from https://develop.svn.wordpress.org/trunk@56644


git-svn-id: http://core.svn.wordpress.org/trunk@56156 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Bernhard Reiter
2023-09-21 08:34:18 +00:00
parent 2f5d2da8f8
commit f6307ff5fc
3 changed files with 96 additions and 35 deletions

View File

@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.4-alpha-56643';
$wp_version = '6.4-alpha-56644';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.