Skip to content
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

Migrating layout.php to WordPress 6.0 #2518

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Apr 5, 2022

⚠️ Depends on Trac ticket: https://core.trac.wordpress.org/ticket/55505 which includes the lib/block-supports/utils.php file and the wp_should_skip_block_supports_serialization() function.

Gutenberg plugin migration to WordPress 6.0 also being tracked in WordPress/gutenberg#39889.

This diff migrates block support layout (lib/block-supports/layout.php) and tests from Gutenberg 13 to WordPress 6.0.

Trac ticket: https://core.trac.wordpress.org/ticket/55505


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.


// If a block's block.json skips serialization for spacing or spacing.blockGap,
// don't apply the user-defined value to the styles.
$should_skip_gap_serialization = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'blockGap' );
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gziolo
Copy link
Member

gziolo commented Apr 5, 2022

wp_should_skip_block_supports_serialization() is already present in WordPress core. Do we have any unit tests that cover the updated functionality?

@youknowriad
Copy link
Contributor

We do have unit tests that cover the image block related filter. They were added here WordPress/gutenberg#39330

@ramonjd
Copy link
Member Author

ramonjd commented Apr 5, 2022

We do have unit tests that cover the image block related filter. They were added here WordPress/gutenberg#39330

Thanks for the tip off. I will pull the tests over in this PR 🙇

@ramonjd ramonjd force-pushed the migrate/block-supports-layout-wordpress-6.0 branch from 079a7c0 to f40cda4 Compare April 5, 2022 23:51
@gziolo
Copy link
Member

gziolo commented Apr 6, 2022

I refactored one of the tests to use the data provider and included code comments in 293a355.

I will commit the changes once CI turns green.

Excelent work @ramonjd. Thank you @youknowriad for including a great hint.

@gziolo
Copy link
Member

gziolo commented Apr 6, 2022

Changes committed in https://core.trac.wordpress.org/changeset/53085.

@gziolo gziolo closed this Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants