Comments (5)
As a proof of concept, I think this is reasonably trivial, the below added here ContentBlocksResolver.php:56 and the reusable blocks seem to resolve as expected. I've not done extensive testing yet, but the GQL response looks good and replacing a few components in active pages seems to work as anticipated. Given it's just replacing the core/block with the content of the rendered reusable block(s), it should be good to go with something as trivial as this?
Let me know if you'd like a PR and I'll wrap up some tests and get that added
// Resolve reusable blocks
$new_parsed_blocks = [];
foreach ($parsed_blocks as $block) {
if ($block['blockName'] === 'core/block' && $block['attrs']['ref']) {
$reusable_blocks = parse_blocks( get_post( $block['attrs']['ref'] )->post_content );
if (!empty($reusable_blocks)) {
array_push($new_parsed_blocks, ...$reusable_blocks);
}
} else {
$new_parsed_blocks[] = $block;
}
}
$parsed_blocks = $new_parsed_blocks;
from wp-graphql-content-blocks.
@williamjulianvicary Thanks. Sure go ahead. We will review the code with the team.
from wp-graphql-content-blocks.
We do require a one time CLA for people adding contributions:
If you could review and fill in this form:
https://docs.google.com/forms/d/1O5bQCRHSSJmrOCAzWYJBIHjBNnVRg2PboSvuB2NfAI4/edit
Then we will send you a DocuSign to complete.
Then we can review your PRs.
Thank you.
from wp-graphql-content-blocks.
That's complete - let me know if you have any questions
from wp-graphql-content-blocks.
Merged #104
from wp-graphql-content-blocks.
Related Issues (20)
- ACF Blocks data is not displaying HOT 3
- Plugin breaks GraphQL schema if CPT slug contains dash (`-`) HOT 2
- Add support for genesis-custom-blocks HOT 16
- Why was `WPGraphQL\ContentBlocks\Blocks\Block::register_fields()` removed. HOT 7
- Fatal error after installing the plugin HOT 2
- v1.1.1 throwing error: Class "WPGraphQL\ContentBlocks\Utilities\WPGraphQLHelpers" not found HOT 9
- Possible Performance Issues HOT 24
- CoreVideo returns false for controls regardless of admin setting HOT 3
- `CoreImageAttributes.width` is type `String`, but should be a `Float` HOT 11
- Expose Rendered HTML for Themes HOT 3
- Fetching plugin blocks HOT 6
- Using the plugin as a submodule with GitHub Actions HOT 7
- `core/list-item` content attribute returns html of nested elements HOT 2
- Full size CoreImageAttributes.width & .height are null HOT 6
- Allow get_block_context_interfaces to be filtered HOT 1
- Custom block attributes not exposed HOT 2
- Can I extend this to support GravityForms? HOT 2
- ${PostType}EditorBlock Interfaces are being registered and implemented with different names HOT 1
- Bug: `BlockWithSupportsAnchor` is causing `DUPLICATE_TYPE` error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wp-graphql-content-blocks.