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
Add experimental API for registering block bindings on the editor side #56732
Add experimental API for registering block bindings on the editor side #56732
Conversation
…-metadata-source' into try/refactor-block-bindings-experiment
Size Change: +34 B (0%) Total Size: 1.72 MB
ℹ️ View Unchanged
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
Closing this for now. The Block Bindings API is shipping in WP 6.5 without the "registration" API on the editor side as explored in this PR: https://make.wordpress.org/core/2024/03/06/new-feature-the-block-bindings-api/. We will probably revisit a similar idea in the future as we improve the API and allow extenders to create their own controls for different kinds of block binding sources. It will likely be part of the source registration API that already exists in the editor but is a private API at the moment of writing. |
🧪 Experimental prototype code ahead! This PR is meant more as an anchoring point in the ongoing discussion about Block Bindings rather than a concrete proposal.
What?
Refactors the editor-side code to add an interface through which new custom sources can be registered.
Why?
Following the discussion in #53300 it makes sense to have a clear API that allows registration of custom sources. This registration should be separate from the "core" which handles the block bindings logic. Each and every source (including custom fields!) should use that same interface in the future.
How?
registerBlockBinding({ name, edit })
function.useAvailableBlockAttributes(blockName)
React hook. This hook should be used in theedit
component passed toregisterBlockBindings()
. Given block name as input, it returns the attributes allowed to be connected to custom sources.Testing Instructions