Skip to content

Connecting block attributes and custom fields & Block Bindings API for WP 6.5 #53300

@SantosGuillamot

Description

@SantosGuillamot
Contributor

Part of:

Related to:


EDIT: Connecting block attributes and custom fields, and the block bindings API tracking issues have been merged into this epic because they are highly related and it seems it is easier to follow having everything under the same discussion.

This issue is meant to keep track of and discuss how to connect block attributes with custom/meta fields and how Block Bindings API should work. It includes a list of tasks needed for this, and we will share updates about the progress here.

  • Block Bindings API: Internal API to connect block attributes and different sources. Not only used for custom fields but for other projects like Partially Synced patterns.
  • Custom Fields: Using the Block Bindings API, support for the "meta_fields" source to connect block attributes and custom fields.

For more context about the reasoning of the block bindings API, you can take a look at its original tracking issue.

Progress

This is a list of things to consider/questions related to the Block Bindings API that will be updated as we go along:

WordPress 6.5 release process

Click to see the list of issues addressed during 6.5 release cycle ---

A couple of things that are important:

  • This project depends on the Block Bindings API: link.
  • We will start supporting just a few core blocks attributes that can be increased in a later phase. We can start with:
    • Paragraph content.
    • Heading content.
    • Image URL.
    • Button link and content.

Fixes/updates for Gutenberg 17.6 RC (Tuesday 30th)

  • Decide the final name of the public class and methods included in this pull request.
    Migrate all the changes suggested in this wordpress-develop pull request to Gutenberg, including the naming decision. #58383
    Decide the final shape of the bindings object used in the blocks and make the necessary changes: #58337
    Backports to WordPress.
    Add more tests for the bindings, especially in the editor.
    Add validation in the WP_Block_Bindings_Registry class like others like WP_Block_Type_Registry are doing: link.

Fixes/updates for WordPress 6.5 beta 1 (February 13th)

  • Review the accessibility of the editor with the accessibility team, including the suggestions made: link.
  • Migrate to Gutenberg the changes made in this core pull request: link. PR: #58683
    Fix a bug with strcasecmp reported here.
    Decide if we should add a WP_Block_Binding_Source class and handle validation there: link. PR: #6042 / Core changeset: 57562
    Refactoring the processing of block bindings into two steps: link. This would solve this issue with the empty images in pattern overrides. PR: #6059
    Add initial documentation. Core changeset: 57560
    Remove unused setAttributes. PR: #58806
    Lock editing by default when the source used in the bindings is not registered in the client and adapt pattern overrides. PR: #58787

Fixes/updates during beta phase

WordPress 6.6 planning

This section will be used to keep track of the issues that could potentially be addressed for WordPress 6.6.

As explained in this comment, the idea is to keep the scope limited and work on more functionalities if there is time at the end of the release cycle.

Initial plan

Keep in mind that this is not set in stone and it might change. The initial idea is to focus on these aspects:

Polish the existing code

  • Add hook to check when we should lock controls when bindings exist: link.
    Use RichText identifier to check if we should make it non-editable: link.
    Explore how to abstract the locking of controls: link.
    Remove the filter when a source is unregistered as discussed here.

And work on new aspects like:

  • Add the possibility of editing the value of the meta fields directly from the bound blocks.
    Improve the UX when the editing of bound blocks is locked.
    Define and implement UX for editing custom fields directly from blocks connected.
    Add support for more core blocks based on feedback. #59607

Out of scope for 6.6

Trying to keep the scope limited for this short release, the idea is to work on these functionalities only once the previous points are finished:

  • Add a UI to allow users to add bindings through the Editor.
    Create new sources: Site data, post data, taxonomy data.
    Explore the possibility of creating a filter to modify the value of the meta field returned. Ex: Change the date format with PHP.
    Explore the possibility of concatenating custom fields somehow. Ex: site_url + field_id.
    Explore the possibility of creating "before/after" setting until an Inline Binding functionality is implemented.
    Replace core blocks like Post Author to use variations using these bindings.
    Create opt-in mechanism and expand support for custom blocks (This depends on the HTML API supporting any HTML tag).
    Change the UI to use the upcoming DataViews: link.
    Probably using DataViews, add the possibility of creating new custom fields.

Metadata

Metadata

Labels

[Feature] Custom FieldsAnything related to the custom fields project - connecting block attributes and dynamic values[Type] IterationScoped iteration of an effort from a tracking issue or overview issue ideally for a major release.[Type] New APINew API to be used by plugin developers or package users.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @mcsf@lgladdy@Mamaduka@youknowriad@getdave

      Issue actions

        Connecting block attributes and custom fields & Block Bindings API for WP 6.5 · Issue #53300 · WordPress/gutenberg