Add support for layout responsive styles#11966
Conversation
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. |
|
noting that WordPress/gutenberg#78543 also has a change to the states block support that is dependent on #11828 which introduces the file. |
9c505b7 to
eaa2a2f
Compare
|
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. |
ramonjd
left a comment
There was a problem hiding this comment.
Aside from the regex, everything looks to be a faithful port. Cheers!
|
|
||
| /** | ||
| * Returns the child-layout-only subset of a layout object. | ||
| * |
| function wp_sanitize_block_gap_value( $gap_value ) { | ||
| if ( is_array( $gap_value ) ) { | ||
| foreach ( $gap_value as $key => $value ) { | ||
| $gap_value[ $key ] = $value && preg_match( '%[\\(&=}]|/\*%', $value ) ? null : $value; | ||
| } | ||
|
|
||
| return $gap_value; | ||
| } | ||
|
|
||
| return $gap_value && preg_match( '%[\\(&=}]|/\*%', $gap_value ) ? null : $gap_value; | ||
| } |
There was a problem hiding this comment.
The Gutenberg PR also uses three backslashes in source:
gutenberg: '%[\\\(&=}]|/\*%'Here I see only two. I think this means it no longer rejects CSS gap values that contain a literal backslashes? Worth checking or creating a unit test if this version is right.
There was a problem hiding this comment.
Oh well spotted, it should definitely be like the gutenberg version, which also matches the existing logic in core that this function is supposed to extract 🤦
| * @since 5.9.0 | ||
| * @since 6.1.0 Added `$block_spacing` param, use style engine to enqueue styles. | ||
| * @since 6.3.0 Added grid layout type. | ||
| * @since 6.6.0 Removed duplicated selector from layout styles. |
| * so it shares a selector with the base layout (the inner block wrapper for | ||
| * wrapper blocks) instead of being scoped to a separate `wp-states-...` class. | ||
| * | ||
| * @covers ::wp_render_layout_support_flag |
|
Thanks for the review @ramonjd! Everything should be fixed now. |
ramonjd
left a comment
There was a problem hiding this comment.
LGTM - thanks for the update.
Trac ticket: https://core.trac.wordpress.org/ticket/65164
Use of AI Tools
Code copied across from WordPress/gutenberg#78543 with the aid of copilot. Verified manually by a human (me).