Skip to content
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

fix typo and link in static-dynamic-rendering.md #64449

Merged
merged 2 commits into from
Aug 16, 2024

Conversation

janpfeil
Copy link
Contributor

What?

Why?

How?

Testing Instructions

Testing Instructions for Keyboard

Screenshots or screencast

Copy link

github-actions bot commented Aug 12, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @janpfeil.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: janpfeil.

Co-authored-by: tyxla <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @janpfeil! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Aug 12, 2024
Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @janpfeil, thanks a lot for your contribution!

I've suggested a few improvements - let me know what you think!

@@ -61,7 +61,7 @@ Dynamic blocks, which we'll explore in the following section, can specify an ini
For a practical demonstration of how this works, refer to the [Building your first block](/docs/getting-started/tutorial.md) tutorial. Specifically, the [Adding static rendering](/docs/getting-started/tutorial.md#adding-static-rendering) section illustrates how a block can have both a saved HTML structure and dynamic rendering capabilities.

<div class="callout callout-info">
WordPress provides mechanisms like the <a href="https://developer.wordpress.org/reference/functions/render_block/"><code>render_block</code></a> are the <code>$render_callback</code> function to alter the saved HTML of a block before it appears on the front end. These tools offer developers the capability to customize block output dynamically, catering to complex and interactive user experiences.
WordPress provides mechanisms like the <a href="https://developer.wordpress.org/reference/functions/render_block/"><code>render_block</code></a> and the <a href="https://developer.wordpress.org/reference/classes/wp_customize_partial/render_callback/"render_callback</a> function to alter the saved HTML of a block before it appears on the front end. These tools offer developers the capability to customize block output dynamically, catering to complex and interactive user experiences.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things I'm suggesting here:

  • The link seems to be incorrect - instead of linking to the customizer's partial render callback, we should lead to either register_block_type or WP_Block_Type that both document the render_callback function.
  • There's a missing closing > of the opening <a> tag.
  • We should keep the wrapping <code></code>.
Suggested change
WordPress provides mechanisms like the <a href="https://developer.wordpress.org/reference/functions/render_block/"><code>render_block</code></a> and the <a href="https://developer.wordpress.org/reference/classes/wp_customize_partial/render_callback/"render_callback</a> function to alter the saved HTML of a block before it appears on the front end. These tools offer developers the capability to customize block output dynamically, catering to complex and interactive user experiences.
WordPress provides mechanisms like the <a href="https://developer.wordpress.org/reference/functions/render_block/"><code>render_block</code></a> and the <a href="https://developer.wordpress.org/reference/classes/wp_block_type/#source"><code>render_callback</code></a> function to alter the saved HTML of a block before it appears on the front end. These tools offer developers the capability to customize block output dynamically, catering to complex and interactive user experiences.

Let me know what you think!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad you reviewed it with care. I was missing the link to render_callback. I'm not familiar with the concepts. Decide for yourself which link makes more sense.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is that neither of the links I provided specifically documents the render_callback argument of register_block_type.

Instead, maybe we can link to https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/creating-dynamic-blocks/ which does contain a good explanation with examples on how to use render_callback.

Feel free to go with that one.

Thanks @janpfeil!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tyxla done, please review for correctness

@shail-mehta shail-mehta added the [Type] Developer Documentation Documentation for developers label Aug 13, 2024
Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 🚀

I appreciate your help improving the docs, @janpfeil 🙌

@tyxla tyxla merged commit 70d2020 into WordPress:trunk Aug 16, 2024
60 checks passed
@github-actions github-actions bot added this to the Gutenberg 19.1 milestone Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants