[wp-trac] [WordPress Trac] #59669: Block: Give `traverse_and_serialize_block(s)`' post-callback access to block instance

WordPress Trac noreply at wordpress.org
Wed Nov 1 12:44:17 UTC 2023


#59669: Block: Give `traverse_and_serialize_block(s)`' post-callback access to
block instance
-------------------------------------------------+-------------------------
 Reporter:  Bernhard Reiter                      |       Owner:  Bernhard
                                                 |  Reiter
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.4
Component:  General                              |     Version:  trunk
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit      |     Focuses:
  dev-reviewed                                   |
-------------------------------------------------+-------------------------
Changes (by Bernhard Reiter):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"57043" 57043]:
 {{{
 #!CommitTicketReference repository="" revision="57043"
 Blocks: During traversal, allow post callback to modify block.

 Both the `$pre_callback` and `$post_callback` functions that are given as
 arguments to `traverse_and_serialize_block(s)` receive a reference to the
 current block as their first argument. However, while any changes that the
 "pre" callback makes to the block are reflected by the serialized markup,
 the same wasn't true for the "post" callback: Any changes that it made
 were only applied ''after'' the block had already been serialized.

 This commit changes the behavior such that `$post_callback`'s changes to
 the current block are also reflected in the serialized markup.

 Reviewed by hellofromTonya.
 Merges [56970] to the 6.4 branch.

 See #59646.
 Props gziolo.
 Fixes #59669.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59669#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list