-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Plugin: Ensure that PHP code for blocks is correctly assigned to WP releases #40179
Conversation
* @param array $metadata Metadata for registering a block type. | ||
* @return array Metadata for registering a block type with the supports shape updated. | ||
*/ | ||
function gutenberg_migrate_old_typography_shape( $metadata ) { |
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.
Added to WordPress core in 5.8.0 release:
https://github.com/WordPress/wordpress-develop/blob/22fbb4a9ae877610f35fa5908c36839d9631674c/src/wp-includes/blocks.php#L1040-L1045
* | ||
* @return boolean Whether or not the feature is supported. | ||
*/ | ||
function gutenberg_block_has_support( $block_type, $feature, $default = false ) { |
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.
https://developer.wordpress.org/reference/functions/block_has_support/ was introduced in WordPress 5.8 and that is the minimum supported version for the plugin.
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.
Nice! LGTM 👍
What?
Follow-up for #36176.
Part of #39889.
As part of this PR, I remove the usage of:
gutenberg_block_has_support
gutenberg_migrate_old_typography_shape
filter's callbackThey were added in WordPress 5.8.
I also moved block-related functionality to the appropriate compat layer files.
Why?
To ensure that compatibility layer functionality gets removed whenever we bump the minimum version of WordPress supported in the Gutenberg plugin.
How?
WordPres 5.9 compat:
_wp_normalize_relative_css_links
functionwp_enqueue_block_style
functiongutenberg_multiple_block_styles
filter's callbackWordPres 6.0 compat (needs to be backported to WP core):
wp_enqueue_block_view_script
functiongutenberg_block_type_metadata_multiple_view_scripts
filter's callbackTesting Instructions
No functional changes. The plugin should still work as before.