-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Block Patterns: Load basic core patterns from Pattern Directory #1298
Conversation
22fddf6
to
662e205
Compare
src/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php
Outdated
Show resolved
Hide resolved
I started looking into the failing test here. It looks like if I comment out the added I have to step away for a bit, but I'll circle back when I return to continue looking into the issue. |
These errors are occurring in
Not sure why those routes don't appear to be registered yet. It may be that the REST Server initialization caused by the |
I pushed a fix. Ideally we'd have some way of detecting when the REST API server needs to be registered built in to the base test class, but alas. |
239b7ea
to
79ef366
Compare
Thanks for tracking that down, @TimothyBJacobs! |
These tests are in fact initializing and using the REST API, so they need to be resetting the server instance like the rest of the REST API tests do.
79ef366
to
c439e17
Compare
Committed this first pass in r51021. |
This ports over the pattern-directory API endpoint from Gutenberg trunk. This was added in WordPress/gutenberg#28800 & WordPress/gutenberg#26578.
I've removed most of the default patterns, and hooked up the Pattern Directory API to return the patterns marked "Core" from https://wordpress.org/patterns/.
This remote loading checks for
core-block-patterns
theme support and adds a new filter,should_load_remote_block_patterns
. Ifcore-block-patterns
theme support is removed, it will disable all core patterns including remote patterns. Ifshould_load_remote_block_patterns
is filtered to return false, the core query blocks will be registered, but the remote request won't happen.This is done without the
blockTypes
support, since WordPress/gutenberg#32113 is still in progress. If I understand the process correctly, that can be done during feature-freeze?Trac ticket: https://core.trac.wordpress.org/ticket/53246
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.