-
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
Partial dynamic block rendering / Static content in dynamic blocks #7331
Comments
Can you clarify what you're trying to accomplish with this use case? |
@danielbachhuber I found this issue yesterday while toying with some ideas. Example use cases:
A related problem is that editing dynamic modules in the Code Editor in hard. This is just five lines in a RichText: <!-- wp:nyordanov/test {"text":[{"type":"p","key":"_domReact3","ref":null,"props":{"children":"RichText"},"_owner":null},{"type":"p","key":"_domReact5","ref":null,"props":{"children":["is ",{"type":"strong","key":"_domReact9","ref":null,"props":{"children":"hard"},"_owner":null}," to"]},"_owner":null},{"type":"p","key":"_domReact13","ref":null,"props":{"children":"edit"},"_owner":null},{"type":"p","key":"_domReact16","ref":null,"props":{"children":"in the"},"_owner":null},{"type":"p","key":"_domReact19","ref":null,"props":{"children":"Code Editor"},"_owner":null}]} /--> |
I wanted to use a mix of static and dynamic output as a workaround, since I am not able yet to output So I figured: Why not save the paragraph statically, and add the gallery stuff on top dynamically in php. Another possible use-case: You could always argue everything is possible with both methods, so just pick one for the entire block. But as I see Gutenberg, it lives and breathes: I want to make working with content more convenient and give options to both editors and developers. Maybe I'm missing something here, but to me not having access to what has been saved statically in php is a wasted potential. |
Closing as duplicate of #5760. |
In the examples you
return null;
insave()
for dynamic blocks.But what if I only want parts of my block to be dynamic and others to be static?
What happens to saved content, when a block gets rendered dynamically with PHP?
I imagine something like this:
$savedHTML
as a parameterThe text was updated successfully, but these errors were encountered: