-
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
Block Bindings API: Add components for the editor UI and create basic UI for the existing sources #57258
Conversation
Size Change: +1.74 kB (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/experimental/blocks.php |
I believe that these are the remaining issues for this part of the prototype. Although we could work on them after this PR is merged.
|
7fb84db
to
8ad9e03
Compare
2e2cfe3
to
25fa668
Compare
6dd8831
to
11ba9d7
Compare
11ba9d7
to
934715b
Compare
@SantosGuillamot What help is needed to move this forward? |
There are still a few uncertainties around the UX of the different sources and, due to its complexity, we decided to focus first on getting an initial version of connecting block attributes and custom fields without any UI for WordPress 6.5. Just having that, would allow users and theme developers to create those connections just changing the block attributes with something like this:
It's a first step to ensure that, whatever we land, works as expected. From there, we can keep adding new functionalities progressively. Apart from that, after this other pull request, the technical implementation will probably be different than the approach used here, so I believe it's better to close this pull request and open a new one once we start working on it. Let me know if that makes sense. Happy to reopen it if you consider it better. |
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 Core SVNIf you're a Core Committer, use this list when committing to
GitHub Merge commitsIf 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. |
This pull request is built on top of #57249.
What?
Related issues:
#54536
#53300
#56867
I'm splitting #56867 into smaller PRs so they are more manageable and discussions can be kept separately. You can find more information in the original PR.
Bear in mind that the UI created in this PR is really basic and still needs to be discussed. I'd like to iterate on it in a later phase.
It covers:
BlockBindingsFill
component that allows different sources to hook into that interface and add their own UI.BlockBindingsFieldsList
component that sources can use if they just want to list some fields.updateBlockBindingsAttribute
helper that sources can use to update the bindings property. It'd be great to explore if we can move it into a React hook.updateBlockBindingsAttribute
helper in the pattern source.BlockBindingsFill
andBlockBindingsFieldsList
components.Why?
The basis pull request allows to process the bindings in the server but there is no way to add the attributes in the editor without writing them directly in the code editor.
Additionally, providing some tools for creating sources will help to add support for site data, user data, or other plugins that want to use it.
How?
The most relevant aspects of the technical implementation are:
createSlotFill
hook to provide the Slot that sources can Fill.blocks.registerBlockType
to inject the Bindings button in the blocks in the whitelist. It also add the context to the blocks without it, although that needs to be reviewed as discussed here.editor.BlockEdit
to inject the Fill.Testing Instructions
For all the testing we have to go to Gutenberg-Experiments and enable the Test Block Bindings option.
Test that adding the bindings attribute works
Test that multiple attributes values can be connected
Repeat the same process but using a button (or an image) to bind the content and the URL.
Test that partially synced patterns keep working as expected
Partially synced patterns experiment should keep working as it does before this PR.
Test creating a new source
You can try creating a new source using the post meta as reference and using the helpers created:
BlockBindingsFill
andBlockBindingsFieldsList
. Once created, it should appear in the block bindings UI, as the post meta does.Remaining issues
updateBlockBindings
to a React hook.