-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block Hooks: Iteration for WP 6.6 #60252
Comments
Finally replying to @leewillis77's comment on the previous Epic -- apologies for the long delay!
Right. Unfortunately, providing a full chain of context seems to be a bit tricky to implement right now, as WordPress doesn't currently communicate the parent to the child block upon stepping into the latter processing. (This is exacerbated by a number of blocks rendering their own, "detached", block trees, e.g. the Template Part or Navigation blocks.) I have to look into this a bit more deeply and might file a Core ticket.
So If you're writing a filter for the Once you've got that working, you can add criteria for BTW have you seen @ndiego's recent Developer Blog article on Block Hooks? It's a great way to get started (and also includes recommendations like the above) 😄
I think this largely harks back to a problem I touched upon in my reply to your first request: There are a number of container blocks that include "controlled" inner blocks (that are fetched from the DB, rather than being included "inline" in the markup), and to make those work, each of them must basically opt into the Block Hooks mechanism by applying it in its render method. For WP 6.5, we've done that for Core's Navigation block; the solution we came up with for that block might be applicable to a number of other parts, both Core and 3rd party. |
I've updated the issue to list the items we're targeting for 6.6. The "headliner" feature is now named block variations, as this seems to be a blocker for the one feature that we're having the strongest demand for (i.e., generic block insertion). The rest is largely smaller UX/DX fixes, some of which depend on some code quality improvements. As I'll be AFK for the next two weeks, @tjcafferkey will take the reins for #43743. Upon my return, we'll evaluate if we can reasonably get something done in time for 6.6; otherwise, we'll likely focus on the smaller improvements instead. |
Hi all 👋 Reminder: The release candidate for Gutenberg Version 18.5 is scheduled for next Friday (May 31st). So anything that is supposed to make it into WordPress 6.6 must be merged by then. Please raise any important issues that need additional attention :) |
Update (for Block Hooks specific stuff; I'll post a separate update on Block Variations to the corresponding issue): I've committed @tjcafferkey's fix that shows the toggle for hooked blocks that were added by a filter to an _un_modified template. Tom has also filed a fix for the harmonization for the Tom has also started work on consolidating how we get the list of hooked blocks. This is a bit of a trickier problem, due to the way we check the result of Given time, we're unlikely to tackle any other Block Hooks related issues for 6.6 (possibly with the exception of moving some more code from the Navigation block into Core, to fully resolve |
The work on WordPress 6.6 has wrapped up. @ockham, what are the next steps for this iteration issue? Do you think we should close it? |
Yes, I think it's fine to close, especially now that it's decided that we aren't going to pursue #43743 (except for variation I'll triage the remaining open issues and we can decide what to do with them. (Due to another project and some AFK time, I might only get around to doing that in about three weeks from now 😬) |
Block Hooks have been formerly know as Auto-inserting Blocks.
Plans for WordPress 6.6
The following is a list of issues and tickets planned for WP 6.5, roughly ordered by priority (and/or order in which we should tackle them for practical reasons).
Named Block Variations
ignoredHookedBlocks
) in order to allow insertion of "generic blocks", i.e. multiple blocks of the same type that are only distinguished by the values of (a subset of) their attributes.UX bugs
#59574
: No toggle shown for hooked blocks added via filter (unless the containing template/part/... has been modified by the user)#60756
: Toggle (re-)inserts hooked block in wrong position (if added by filter)Code quality
#60759
: HarmonizeignoredHookedBlocks
metadata injection logic#60854
) and into Post Content (#61074
) (see below).#60769
: Consolidate approach to get the list of hooked blocksDX improvements
#60854
: Allow insertion as first or last child of Template Part block (WP 6.7)#61074
: Enable for post contentthe_content
and corresponding REST API endpoint filters), see e.g. POC: Block Hooks API: Cart and Checkout Integration woocommerce/woocommerce#46859#60906
: Allow adding toggle without injecting hooked blockFor later releases
DX improvements
#61078
: Consider introducing a dedicated endpoint.UX improvements
Performance
parse_blocks
/traverse_and_serialize_blocks
by a streaming parser.Uncategorized
allowedBlocks
field and control for users #53989allowedBlock
attribute that's currently used by a number of blocks; AFAICT, it's only handled on the client side, and basically passed through to theInnerBlocks
component as a prop. I'm a bit hesitant to use something like this as it seems currently really up to each individual block, with no standardization, especially on the server (e.g. in the shape of block-supports)."multiple": false
.useOnce
."multiple
field was originally introduced for a post editor context; it isn't really well-defined in a template/Site Editor, as @gziolo has observed.Closed as WONTFIX, see this comment.#60852
: Make conditional tags work when processing content for REST APINote that gettingis_singular()
to work would allow users to inject a hooked block only when the current template is for a custom post type (e.g.if ( is_singular( 'book' ) ) { /* ... */ }
), which seems to be a recurring request.The text was updated successfully, but these errors were encountered: