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

Docs: Add documentation for render_block and register_block_type_args to Block Filters #64118

Merged
merged 3 commits into from
Aug 1, 2024

Conversation

ndiego
Copy link
Member

@ndiego ndiego commented Jul 30, 2024

Fixes #64037

What?

The documentation for Block Filters currently does not mention the register_block_type_args or ender_block/render_block_{block/name} filters, which are some of the most used filters for extending and modifying blocks.

This PR adds brief descriptions and an example for each as well as a few other edits. Further edits will be needed for this page as some of the other filters are missing examples. I will tackle that in a follow-up PR.

@ndiego ndiego added the [Type] Developer Documentation Documentation for developers label Jul 30, 2024
@ndiego ndiego self-assigned this Jul 30, 2024
Copy link

github-actions bot commented Jul 30, 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.

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

Co-authored-by: ndiego <[email protected]>
Co-authored-by: juanmaguitar <[email protected]>

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

@juanmaguitar
Copy link
Contributor

I'm missing some guidance in this page about the mixture of PHP and JS functions.
We could add some brief intro of the type of APIs available for each section (Registration, Frontent, Editor...) and some context for that.

For example, registration happens on both the server and the client, so there are APIs to modify block metadata before registration on both sides, but the editor part only happens on the client, so there are only JS functions to alter this side of the block's management.

This could be helpful for developers to understand (and remember) the possibilities and limitations of these filters.

docs/reference-guides/filters/block-filters.md Outdated Show resolved Hide resolved
docs/reference-guides/filters/block-filters.md Outdated Show resolved Hide resolved
@ndiego
Copy link
Member Author

ndiego commented Jul 31, 2024

For example, registration happens on both the server and the client, so there are APIs to modify block metadata before registration on both sides, but the editor part only happens on the client, so there are only JS functions to alter this side of the block's management.

I added a section about this and also linked to the block registration guide for more info.

@ndiego ndiego requested a review from juanmaguitar July 31, 2024 17:30
@ndiego ndiego enabled auto-merge (squash) July 31, 2024 17:31
@ndiego ndiego merged commit 7f80f6e into trunk Aug 1, 2024
62 of 63 checks passed
@ndiego ndiego deleted the doc/add-missing-filter-to-block-filters-doc branch August 1, 2024 16:05
@github-actions github-actions bot added this to the Gutenberg 19.0 milestone Aug 1, 2024
@gziolo
Copy link
Member

gziolo commented Aug 3, 2024

Cool, thank you for improving this document 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add documentation for render_block and register_block_type_args to Block Filters
3 participants