Patterns and reusable blocks are now merged. This allows for the user to save patterns (synced or unsynced). Also, reusable blocks are now called synced patterns.
Use wp_pattern_sync_status property to distinguish types (API endpoint - /v2/blocks).
wp_pattern_sync_status = '' - synced
wp_pattern_sync_status = 'unsynced' - unsynced
In addition to the content block type that is created, a vocabulary (Pattern Category) needs to be created and add a taxonomy reference to Reusable block type.
Add Sync Status field to Reusable block type.
Pattern Category terms can be created when saving patterns.
Add wp_pattern_category (array of taxonomy ids) to API endpoints.
Issue fork gutenberg-3402975
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #15
marcofernandes commentedComment #17
codebymikey commentedThere's no update hook for the new reusable block
field_pattern_categoryandfield_pattern_sync_statusfields introduced here. This breaks on a site upgrading from 2.x whenever you attempt to add a new pattern:An upgrade path should be created or documented. Ideally something in an update hook.
I think there might also be an issue with the autosave API path
/wp/v2/pages/-1/autosavesno longer being matched by the/\/wp\/v2\/(.*)\/autosaves\?(.*)/gregex when trying to update an existing API path.I think we should probably add a
console.warn()call in the api-fetch before returning the "API handler not found" promise, just so it's easier to easily any missing/breaking REST API implementations in future releases.Comment #19
marcofernandes commentedComment #20
codebymikey commentedSorry it took a while to get back to this. I like the approach, but it seems like
\Drupal::service('config.installer')->installDefaultConfig('module', 'gutenberg')will override any local configuration overrides the sites might have, so we need special handling for it.I've pushed an update to the branch with the updated logic, feel free to test and review, and let me know if it all makes sense.
Comment #21
marcofernandes commentedI tested from a clean Drupal instance, installed Gutenberg 2.x, enabled Gutenberg for Basic Page changed Gutenberg text format a bit just to check if configuration wouldn't be override. Then I updated Gutenberg to this branch and did an update db but it threw this error:
Ran update db again but at this time no error occurred and configuration seemed to be ok. At least no override on the text format settings and fields were created.
Comment #30
marcofernandes commentedComment #31
marcofernandes commented