-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Pass content to render callback #5760
Comments
Other necessary situations for content to be accessible inside the render callback include:
|
I have quite a few more examples where the block content is required by the dynamic block renderer. Some of these are mentioned in the above referenced issue; oik-block/22. In more complicated examples the content of the shortcode / block may require pagination to:
My solutions, which involve shortcodes, perform pagination logic against the shortcode content. |
This is probably something to have. The issues cross-referenced above may suggest other use cases. Further, here's a use case for the core Gallery block: |
Just for reference - there's a pretty stale PR here #6239 |
For two of the examples I provided above, it is also necessary to have the ability to pass child block objects into a render callback. Member content, for example, should be able to contain any number of blocks, and then conditionally choose whether to render them or not. This functionality is currently possible with nested shortcodes, so should not be regressed by moving to Gutenberg blocks. The referenced PR does not appear to include this functionality. |
Passing the content to the render callback was re-added in #8077, it'll be released in Gutenberg 3.4. 🙂 Passing the child block objects is a little trickier, and will likely require replacing the current |
Issue Overview
The block content is no longer available in the render callback. It was removed here.
However, it would be very useful to have this data available. I have 2 use cases.
There are alternative ways to achive these goals. I could have my dynamic block fully rendered in PHP. I could just allow my container block to store all the data in the post content. However this isn't very flexible.
The text was updated successfully, but these errors were encountered: