Patterns: Add the pattern name to pattern blocks when they are converted #10248
Patterns: Add the pattern name to pattern blocks when they are converted #10248ramonjd wants to merge 1 commit intoWordPress:trunkfrom
Conversation
|
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. |
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. |
b5812e5 to
d8f1d20
Compare
|
Is there other metadata we could/should add to patterns - some of them seem to also contain a longer description. It would be good to support as much metadata as possible IMO. |
Good question. What do you think the editor might need? There are also optional categories and block types, which could come in handy if the editor ever wanted to extend "change design" to patterns bundled with templates. I'm not sure. |
|
The description would be useful for WordPress/gutenberg#72574. Not sure about the others. |
d8f1d20 to
ed8d449
Compare
Done! |
ed8d449 to
dc0bc0a
Compare
ef3a7bc to
a640eaa
Compare
src/wp-includes/blocks.php
Outdated
| $blocks_to_insert = parse_blocks( trim( $pattern['content'] ) ); | ||
|
|
||
| $blocks_to_insert = parse_blocks( trim( $pattern['content'] ) ); |
There was a problem hiding this comment.
| $blocks_to_insert = parse_blocks( trim( $pattern['content'] ) ); | |
| $blocks_to_insert = parse_blocks( trim( $pattern['content'] ) ); | |
| $blocks_to_insert = parse_blocks( trim( $pattern['content'] ) ); |
a640eaa to
44c4c8f
Compare
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Source: WordPress/gutenberg@ec6ec9e
bbf23e7 to
2a32b89
Compare
|
I've rebased this and it's ready for a final test. It should reflect the changes committed to Gutenberg: Checking with @talldan that this approach has been working well in your testing over the last few weeks. Thanks! |
andrewserong
left a comment
There was a problem hiding this comment.
This tests well for me, good code coverage and matches the changes that have been in Gutenberg for a fair while now. As this feature is slated for 7.0, I think this is a good time to land this, and it can continue to be tested throughout the Beta phase.
IMO this LGTM 🚀
…single-root patterns, allowing the pattern name and title to be stored in the block attributes.
2a32b89 to
9967b85
Compare
Yep, I think so. There was some additional feedback in WordPress/gutenberg#75235, but I think it can be considered additive if there's an outcome. |
Builds upon #10180
Props to @scruffian
Modifies the
resolve_pattern_blocksfunction to include metadata for single-root patterns, allowing the pattern name and title to be stored in the block attributes. The metadata contains thepatternNameandnameattributes.This enables identification of patterns inside templates and allows for special treatment in the editor.
This will be used to test contentOnly editing (WordPress/gutenberg#71517), so that themes that use patterns automatically opt into this behaviour.
Trac ticket: https://core.trac.wordpress.org/ticket/64123
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.