Opened 8 weeks ago
Last modified 5 days ago
#62716 new defect (bug)
Block Hooks: Absorb logic to set ignored hooked blocks post meta into `apply_block_hooks_to_content`
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 6.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
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. It has been suggested by @gziolo that we absorb it into apply_block_hooks_to_content
.
Change History (8)
#2
@
13 days ago
Looks like we'll need to prioritize this to fix a bug I introduced when enabling Block Hooks for post content, see https://github.com/WordPress/gutenberg/issues/68605#issuecomment-2618970655.
#3
@
13 days ago
- Milestone changed from Awaiting Review to 6.8
- Type changed from enhancement to defect (bug)
This ticket was mentioned in PR #8212 on WordPress/wordpress-develop by @Bernhard Reiter.
12 days ago
#4
- Keywords has-patch added
Port of https://github.com/WordPress/gutenberg/pull/68926.
More details TBD.
Trac ticket: https://core.trac.wordpress.org/ticket/62716
@Mamaduka commented on PR #8212:
10 days ago
#5
Adding a unit test for unhappy paths might be a good idea. When post_content
returns something different due to the filter.
@Mamaduka commented on PR #8212:
6 days ago
#6
@ockham, is this ready for review?
@Bernhard Reiter commented on PR #8212:
5 days ago
#7
@ockham, is this ready for review?
Not quite yet -- I still need to increase test coverage, and audit other callsites of apply_block_hooks_to_content
to see if they should be changed to call apply_block_hooks_to_content_from_post_object
instead.
I won't be able to work on this PR this week, but I'll continue work next week. I hope that works for you time-wise, @Mamaduka?
@Mamaduka commented on PR #8212:
5 days ago
#8
Thanks, @ockham!
That timeline should be okay for now. We just need to make sure this is merged before Beta 1.
Thank you for opening this ticket!