#60008 closed enhancement (fixed)
Block Hooks: Store information about known hooked blocks in anchor block metadata
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
In order to allow injection of hooked blocks into modified layouts (i.e. templates, parts, and patterns) (see #59646), we need a different technique for the frontend to know whether or not to insert a hooked block.
An example scenario is described in https://core.trac.wordpress.org/ticket/59646#comment:2. It is shown there that an attribute of the anchor block is a suitable location to persist that information; the global metadata
field is an obvious choice, as it is guaranteed to be available in any possible block.
Change History (4)
#4
@
12 months ago
i hope this is make it easy to understand it !
Imagine we're giving our anchor block a bit of a makeover, like adding a pocket where it can store notes about its friends, the hooked blocks. We'll call it the "Hooked Block Diary" for our anchor block.
Personality Upgrade: Our anchor block is getting a new feature called the Hooked Block Diary. It's like giving it a memory to remember its buddies.
Accessorizing: We're adding a special section in the anchor block's diary to jot down names of its hooked block friends. Each name gets a checkbox, like a friend list.
Social Check: When the anchor block wants to place a hooked block in its layout, it flips through its diary to see if the friend's name is checked. If it is, the hooked block gets an invite to the party!
Custom Tailoring: We'll tailor the diary's pages to fit nicely with the anchor block's style, making sure it blends seamlessly into its design.
Friendship Testing: We'll do some testing to make sure the anchor block knows when to invite its hooked block buddies and when to leave them out, ensuring smooth interactions.
Keeping a Journal: We'll document all the changes we made, like how we upgraded the anchor block's diary and taught it to be a good host to its hooked block friends.
Fit and Finish: Once everything looks good and works smoothly, we'll integrate these changes into our system and make sure they play well with the rest of the team.
Feedback Session: We'll chat with the other team members to see if they like the anchor block's new diary and make any tweaks based on their suggestions.
Launch Party: Finally, when everything's just right, we'll roll out the updated anchor block with its fancy new diary to the world, ready to host all its hooked block friends with style!
Re-linking an existing PR doesn't seem to have worked, so here goes: https://github.com/WordPress/wordpress-develop/pull/5712