Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Docs: Fundamentals of Block Development - Static or Dynamic rendering of a block #57250
Docs: Fundamentals of Block Development - Static or Dynamic rendering of a block #57250
Changes from 1 commit
155b40b
a66d0f4
c8144e5
28da078
1434699
98587a8
f5e5732
3233c88
d830bfc
b33923c
dc8d2d8
9f629b7
5a6dd25
b9e9bc2
798df76
c9d2068
5885922
e6f973a
62407bf
bcddeb8
af1577c
add1bba
39ece62
9fb116a
9f45386
538f438
6df94bc
d26ed17
d93db3c
5995411
1c8bd48
879b3ca
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I feel like this is very confusing. This explains how to use dynamic rendering without explaining first what dynamic rendering even is / letting the reader know that there are two different kinds of rendering
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.
Technically this is not entirely correct. Yes static blocks save their markup to the database and return said markup on the frontend. However both core and extenders can and do modify that markup before it gets rendered on the frontend via the
render_callback
orrender_block
hook.An example of this is the core cover block which is a static block that does some PHP magic if the "use featured image" setting to dynamically inject the featured image.
Same with the Image block. Yes it saves markup to the DB. But when the image is served through the media library the
sourceset
generation etc is done on the server.The List block is a static block that dynamically gets it's wrapping class name (
wp-block-list
) injected into the blocks markup on the server.My point here is not that this should all be documented here. Instead I worry that the current explanation makes one feel too "safe" that the markup generated in the
save
function in JS is output 100% as is without modification. Which is not true.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.
Thanks for this explanation. Based on your explanations I agree the current text may be misleading.
I'll work on a different text proposal to take these cases into account.