Add Pattern Directory support to the core editor
The core editor should allow users to search and insert block patterns from the pattern directory, in a similar way to the block directory.
Tentative assumptions:
- Unlike block plugins there is probably no "install" step needed. Patterns from the directory can simply be inserted into a post exactly as core patterns work at present.
- Core patterns might be moved to the Pattern Directory, so they can be improved independent of the core release schedule.
- A local REST API endpoint for searching the pattern directory might be needed, in a similar manner to the block directory endpoint. (#3)
- Patterns from the directory can probably be listed in the same UI as core patterns are at present.
This is an umbrella task, specific issues should be created as needed.
I un-checklisted the assumption list since they're not actions. From here, I see the action(s) as
- [x] Create a wp.org endpoint that will serve patterns (#6)
- [x] Import core patterns into the CPT on wp.org
- [x] Deprecate and/or Remove hardcoded core patterns from Core? back-compat concerns?
- [x] Create a local endpoint (in Gutenberg) which will query the wp.org endpoint, like block directory endpoint (#3)
- [x] Update GB to use this endpoint to load core patterns (server-side) https://github.com/WordPress/gutenberg/pull/28800
- [ ] Add functionality (state/actions/etc) to dynamically load patterns client-side
- [ ] Add support for searching the API & loading pattern results
In past conversations we haven't discussed changing the patterns UI, only the backend data source, so I think that's still a safe assumption.
The Core patterns are all imported into the CPT now. I left the box above unchecked since we haven't removed them from Core yet.
Although, I'd be tempted to just mark the wp-includes/block-patterns/ as deprecated, but leave them permanently 🤔
Removing them would cause fatals for any plugins that are requreing them.
I separated importing and removing into separate checklist items, so the checklist can reflect what's done and what's not.