Add support for column and row spans in grid children.#6493
Add support for column and row spans in grid children.#6493tellthemachines wants to merge 7 commits into
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. |
|
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. |
|
I've added a test so marking this one ready for review! |
| */ | ||
| add_filter( | ||
| 'render_block_data', | ||
| function ( $parsed_block, $source_block, $parent_block ) { |
There was a problem hiding this comment.
Just double-checked the WP coding standards, and it looks like it's discouraged to use anonymous functions in filters:
Closures should not be passed as filter or action callbacks, as removing these via remove_action() / remove_filter() is complex (at this time) (see #46635 for a proposal to address this).
Should we move this to a named function so that plugins (if they really wanted to) are able to remove_filter this?
andrewserong
left a comment
There was a problem hiding this comment.
This is testing great for me on the site frontend, and matches the merged PRs in Gutenberg as far as I can tell 👍
Just left a couple of minor nits. I think the main issue to fix in terms of WP coding style is to make the render_block_data callback a named function so that it can be removed by a plugin if need be, but otherwise this is looking good to me!
| ), | ||
| ), | ||
| ), | ||
| 'expected_output' => '<p class="wp-container-content-1">Some text.</p>', // The generated classname number assumes `wp_unique_id` will not have run previously in this test. |
There was a problem hiding this comment.
Tiny nit: the code now uses wp_unique_prefixed_id so should the comment refer to that now, too?
| 'expected_output' => '<p class="wp-container-content-1">Some text.</p>', // The generated classname number assumes `wp_unique_id` will not have run previously in this test. | |
| 'expected_output' => '<p class="wp-container-content-1">Some text.</p>', // The generated classname number assumes `wp_unique_prefixed_id` will not have run previously in this test. |
There was a problem hiding this comment.
It's probably worth including the prefix in Andrew's comment too, wp_unique_prefixed_id( 'wp-container-content-' ), as the counter is unique to each prefix.
There was a problem hiding this comment.
Done, thanks!
| @@ -181,6 +181,7 @@ public function test_outer_container_not_restored_for_aligned_image_block_with_t | |||
| * @param string $expected_output The expected output. | |||
| */ | |||
| public function test_layout_support_flag_renders_classnames_on_wrapper( $args, $expected_output ) { | |||
There was a problem hiding this comment.
I notice this function includes references to the tickets directly above it. Should the linked trac ticket be added to that list?
andrewserong
left a comment
There was a problem hiding this comment.
Thanks for the updates! This is still testing well, and the code looks good to me 👍
| return $parsed_block; | ||
| } | ||
|
|
||
| add_filter( 'render_block_data', 'wp_add_parent_layout_to_parsed_block', 10, 3 ); |
There was a problem hiding this comment.
Is it possible to add unit test for new filter?
There was a problem hiding this comment.
Tests added!
|
Committed in r58170. |
Trac ticket: https://core.trac.wordpress.org/ticket/61111
Syncs the changes from WordPress/gutenberg#58539, WordPress/gutenberg#59057, WordPress/gutenberg#59452 and WordPress/gutenberg#61392 to core.
To test, paste the following markup in a post:
test markup
Save and view on the front end. It should show grid items spanning multiple columns and rows:
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.