-
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: Display toggle for hooked blocks added via filter #59396
Block Hooks: Display toggle for hooked blocks added via filter #59396
Conversation
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +945 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested it according to the instructions and it works fine for me! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change tests as expected 👍
Are those limitations problematic? Will it make things even more confusing to users that the toggles now show up for blocks added by filters, but only if the template has modifications? Or is it still a net win?
I don't feel sufficiently well informed to opine on this.
I left a comment on this change for consideration. It's not blocking.
Show the Block Hooks toggle for hooked blocks that were added via the `hooked_block_types` filter (rather than at block registration time, i.e. via the `blockHooks` field in `block.json`), by evaluating the anchor block's `ignoredHookedBlocks` metadata attribute. (This attribute is only present if the containing template/part/pattern has user modifications.) Co-authored-by: ockham <bernhard-reiter@git.wordpress.org> Co-authored-by: gziolo <gziolo@git.wordpress.org> Co-authored-by: michalczaplinski <czapla@git.wordpress.org> Co-authored-by: sirreal <jonsurrell@git.wordpress.org>
I just cherry-picked this PR to the update/packages-6.5-rc1 branch to get it included in the next release: 2bc516a |
Show the Block Hooks toggle for hooked blocks that were added via the `hooked_block_types` filter (rather than at block registration time, i.e. via the `blockHooks` field in `block.json`), by evaluating the anchor block's `ignoredHookedBlocks` metadata attribute. (This attribute is only present if the containing template/part/pattern has user modifications.) Co-authored-by: ockham <bernhard-reiter@git.wordpress.org> Co-authored-by: gziolo <gziolo@git.wordpress.org> Co-authored-by: michalczaplinski <czapla@git.wordpress.org> Co-authored-by: sirreal <jonsurrell@git.wordpress.org>
I've just removed the |
What?
Show the Block Hooks toggle for hooked blocks that were added via the
hooked_block_types
filter (rather than at block registration time, i.e. via theblockHooks
field inblock.json
).Why?
To improve UX. It is otherwise somewhat surprising for users that the toggle doesn't show up.
How?
By evaluating the anchor block's
ignoredHookedBlocks
metadata attribute. This attribute is only present if the containing template/part/pattern has user modifications, which causes the following limitations:Limitations
Note that this only works for templates/parts/patterns that have been modified by the user.
Furthermore, note that for hooked blocks added by filters, the client does not know their relative positions, so when enabling the toggle, it will default to inserting the hooked block after the current (anchor) block.
Question
Are those limitations problematic? Will it make things even more confusing to users that the toggles now show up for blocks added by filters, but only if the template has modifications? Or is it still a net win?
Testing Instructions
trunk
, or the latest WP 6.5 Beta.To ensure that this is indeed due to this PR, switch to
trunk
and verify that the Plugins panel is absent for the Like Button.Screenshots or screencast