-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add the block data api plugin #77
Conversation
git-subtree-dir: lib/vip-block-data-api git-subtree-split: 2032b58009129c976af9ce9598e59a9681d5e261
Tested this locally, works great! Used this query to test the Block data WPGraphQL integration as well: query AllPosts {
posts {
nodes {
id
title
blocksData {
blocks {
name
attributes {
name
value
}
}
}
}
}
} After setting permalinks, the REST API at |
/** | ||
* VIP Block Data API. | ||
*/ | ||
if ( is_plugin_enabled( 'block-data-api' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a chance the Block Data API also lands in mu-plugins
? If so, and you want to prefer the mu-plugins version, you might want to proactively add some logic here to determine which version "wins."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! We have that logic built-in. In the plugin itself we verify that we're not double-loading. On the mu-plugins
integration side, we also have logic to prefer the customer version of the plugin, if installed.
I spent some time just now testing what happens if the Block Data API plugin is installed, as well as the bundle with the Block Data API feature enabled, as well as the mu-plugins
version. The priority goes:
- Plugin version first
- Bundle version second, if the plugin is disabled (second alphabetically)
- The
mu-plugins
version of the plugin, if everything else is disabled
This fits our original intent to prefer customer code first, and works fine between the bundle and normal Block Data API plugin as well. Everything is working as designed.
README.md
Outdated
### WPGraphQL Preview | ||
|
||
This plugin overrides WordPress's native preview functionality and securely sends you to your decoupled frontend to preview your content. This ensures that your preview content has parity with your published content. It works by issuing a one-time use token, locked to a specific post, that can be redeemed by the frontend to obtain preview content for that post. | ||
|
||
**This plugin currently only works with our Next.js boilerplate** and should be disabled if you are not using it. If you are interested in using this plugin for other frontend frameworks, please see the [preview `README`][preview-readme]. | ||
|
||
### VIP Block Data API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to put both options next to each other and add a "Which should I choose?" section. That section can even just say, "we already recommend the block data API but here are some caveats"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point, thanks for pointing that out. I've added this, and added what I think would be helpful in making this decision. Lemme know what you think.
0c0d679 Merge pull request #56 from Automattic/planned-release/1.2.0 b8d47ef Merge pull request #54 from Automattic/update/warning-for-php-8-and-abover 6d57703 Version the right way 6de847a Set the config for the php v to 8.0 as well b3f4479 Require php 8, and set the symfony versions fc85182 php configs set to 8.0 11407ea set min wp to 5.9 91ba9b1 Set min version to 8.0, upgrade packages and fix include/exclude bug git-subtree-dir: lib/vip-block-data-api git-subtree-split: 0c0d679b27d41afd3bed20758de4aed3d75f2cd6
…k-data-api-to-bundle
Note here - we just merged a change into the Block Data API and released version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving for the merge. Thank you @ingeniumed for the integration and documentation!
Description
The purpose of this PR is to add the block data api plugin into the bundle. Since the block data api plugin has a rest and graphQL endpoint, this will now enable both of the APIs with this bundle.
The eventual goal would be to replace the bespoke the
WPGraphQL Content blocks
plugin, in favour of this plugin. The first step is add the plugin in, and then slowly add in any missing features so we can eventually deprecate it.To review this PR, the changes that have been made:
git subtree
:git remote add -f block-data-api-remote git@github.com:Automattic/vip-block-data-api.git
git subtree add --prefix lib/vip-block-data-api block-data-api-remote trunk --squash
The following is how you update it:
git fetch block-data-api-remote trunk
git subtree pull --prefix lib/vip-block-data-api block-data-api-remote trunk --squash
settings.php
vip-decoupled.php
Steps to Test
wp-json/vip-block-data-api/v1/posts/1/blocks
rest endpoint can be hit