-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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: Add new hooked_block
filter
#6136
Conversation
To quote my own concerns:
Note that this duplicates |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
"Duplicating" the variable again is the whole point of it :) Just left this as a comment on the ticket as well, but about moving |
Given the choice, I think I'd swallow the pill and would put it in the second position (i.e. after The chief reason being that substituting for parameters, it's at least somewhat natural to read: ..., $hooked_block_type, $relative_position, $parsed_anchor_block, ... becomes e.g. ..., 'ockham/like-button`, `after`, `core/post-content`,... which does exactly what it says: It inserts a Like Button block after the Post Content block. (Furthermore, we have a convention of sorts that |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Committed in https://core.trac.wordpress.org/changeset/57660 |
Thank you for landing this @swissspidy! |
In
[57354]
(#5835), a newhooked_block_{$block_type}
filter was introduced that allowed extenders to specify attributes and inner blocks for hooked blocks.@swissspidy pointed out that for filters with a dynamic name portion like this, it is customary to have a "non-dynamic" counterpart filter (i.e.
hooked_block
, in this case).There are a few concerns around the implications for the function signatures for each filter. We can discuss them here (or on a PR that implements this feature) and decide how to proceed.
Trac ticket: https://core.trac.wordpress.org/ticket/60574
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.