-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Block Bindings: Docs API reference. #66251
Conversation
Flaky tests detected in fa3fbe5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11597084347
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
472ee5a
to
0cb8c9d
Compare
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 found a few typos; I'll push a commit to fix those and left a few other suggestions.
One thing: The parameter definitions throughout the document are inconsistent and repeat themselves unnecessarily. I suggest revising the definitions like in this comment using either colons (:) or hyphens (-) between the property name and its description to make these easier to read.
@cbravobernal No worries, I added back the missing bits and added a few more revisions 👍 Feel free to roll back anything you disagree with. |
The `label` argument will override the one defined on the server if they are different. | ||
|
||
|
||
This example will show a custom post meta date in the editor and, if it doesn't exist, it will show today's date. The user can edit the value of the date. (Caution: This example does not format the user input as a date—it's only for educational purposes.) |
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 would polish the example to show an "e2e process" of how a source should be registered, first in the server and then improved in the editor. I'm saying this because I can see we are defining a different usesContext
when in most cases label
and usesContext
shouldn't be defined in the client.
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 added a comment (with the option to skip it). But in my humble opinion, documentation should not follow a tutorial's structure. The developer may access only to this part, skipping previous steps.
Link: 2a6bf13
- `canUserEditValue`: `function` to determine if the user can edit the value. The user won't be able to edit by default. (optional) | ||
- `getFieldsList`: Experimental `function` that should not be used yet by third-party developers in production, as it is subject to change and may be removed in upcoming releases. It creates a list for the block bindings UI with post meta. | ||
|
||
The `label` argument will override the one defined on the server if they are different. |
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.
Should we move this sentence to the label
property explanation?
This is looking great 👏 We can keep iterating on it once it is merged.
They are already documented in the code, but maybe it makes sense to include something in the docs. |
@@ -371,6 +371,12 @@ | |||
"markdown_source": "../docs/reference-guides/block-api/block-attributes.md", | |||
"parent": "block-api" | |||
}, | |||
{ | |||
"title": "Bindings", |
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.
So great to see it exposed here ❤️
Addressed in fa3fbe5 |
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.
This is looking good to me
* Initial commit * Second commit, still not complete * More docs * More fixes * First draft written, still needs grammar check * Applied AI corrections * Changes requested * Address more reviews * Update getFieldsList expanation * Fix wrong function * Fix misspeel * Recover Artemio's commits * Edit references * Update docs * Fix typos, formatting, omissions * Add colons to editor registration definition * Add missing import * Add code markdown for type * Tighten language and format types * Remove extraneous 'a', fix typo * Address Mario's feedback * Add comments * Add manifest * Fix word usage * I edited the wrong file * Add versions, fix label --------- Co-authored-by: cbravobernal <cbravobernal@git.wordpress.org> Co-authored-by: artemiomorales <artemiosans@git.wordpress.org> Co-authored-by: justintadlock <greenshady@git.wordpress.org> Co-authored-by: gziolo <gziolo@git.wordpress.org> Co-authored-by: SantosGuillamot <santosguillamot@git.wordpress.org>
What?
Initial draft for Block Bindings
Fixes #63026
Why?
Documentation is necessary.