[wp-trac] [WordPress Trac] #62716: Block Hooks: Absorb logic to set ignored hooked blocks post meta into `apply_block_hooks_to_content`

WordPress Trac noreply at wordpress.org
Thu Dec 19 16:00:18 UTC 2024


#62716: Block Hooks: Absorb logic to set ignored hooked blocks post meta into
`apply_block_hooks_to_content`
-----------------------------+-----------------------------
 Reporter:  Bernhard Reiter  |      Owner:  (none)
     Type:  enhancement      |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 Per [59523] and [59543], Block Hooks are applied to post content and
 synced patterns, respectively.

 In order to allow inserting hooked blocks as first and last children of a
 Post Content block (`core/post-content`), synced pattern (`core/block`),
 Template Part block (`core/template-part`, [60854]), and Navigation block
 (`core/navigation`), the block markup gathered from the corresponding post
 type is temporarily wrapped in a "virtual" instance of the respective
 block type. That temporary wrapper block furthermore has its
 `metadata.ignoredHookedBlocks` attribute set based on the corresponding
 post meta from the DB.

 The Block Hooks algorithm is then applied to the full markup (including
 the wrapper block), thus reading and/or updating the block wrapper's
 `metadata.ignoredHookedBlocks`. (During a write operation, that metadata
 is then synced back to the post meta in the DB). Finally, the wrapper
 block is removed.

 This pattern -- first introduced for the Navigation block -- is now
 repeated across a number of block types.
 [https://github.com/WordPress/gutenberg/pull/68058/files#r1891558424 It
 has been suggested] by @gziolo that we absorb it into
 `apply_block_hooks_to_content`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62716>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list