-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Group Block: Avoid rendering the layout config twice #33045
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
Conversation
| if ( ! function_exists( 'wp_render_layout_support_flag' ) ) { | ||
| // Register the block support. | ||
| WP_Block_Supports::get_instance()->register( | ||
| 'layout', |
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.
Ideally this "key" should be unique and override the existing block support, maybe something to improve in the registry in Core later.
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.
Unique key makes sense.
The main problem here is the filters, so I used a single conditional wrapper for both.
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.
I wonder if we should use conditionals or actually override the logic in core in case it changes in the plugin. I think we can probably start with ignoring these changes first though.
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.
Block support from the plugin should override one from the core. We can probably use higher priority for filters when we need to override the logic in the core.
youknowriad
left a comment
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.
LGTM
|
It looks like double containers also were added to the snapshot. |
|
yeah that should have raised flags already :) |
Description
When the plugin is used with WordPress 5.8-betas, the Layout configuration is rendered twice to the block wrapper. PR adds checks for core functions and only users plugin hooks for WP < 5.8.
Fixes #33005.
How has this been tested?
wp-container-*class and<style>tag shouldn't be appended to Group block container.Types of changes
Bugfix
Checklist:
*.native.jsfiles for terms that need renaming or removal).