Make WordPress Core


Ignore:
Timestamp:
02/01/2024 12:52:54 PM (15 months ago)
Author:
youknowriad
Message:

Editor: Add the Block Bindings API.

This introduces the Block Bindings API for WordPress.

The API allows developers to connects block attributes to different sources. In this PR, two such sources are included: "post meta" and "pattern". Attributes connected to sources can have their HTML replaced by values coming from the source in a way defined by the binding.

Props czapla, lgladdy, gziolo, sc0ttkclark, swissspidy, artemiosans, kevin940726, fabiankaegy, santosguillamot, talldanwp, wildworks.
Fixes #60282.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/block-bindings/register.php

    r57385 r57514  
    1818
    1919    /**
     20     * Set up before each test.
     21     *
     22     * @since 6.5.0
     23     */
     24    public function set_up() {
     25        foreach ( get_all_registered_block_bindings_sources() as $source_name => $source_properties ) {
     26            unregister_block_bindings_source( $source_name );
     27        }
     28
     29        parent::set_up();
     30    }
     31
     32    /**
    2033     * Tear down after each test.
    2134     *
     
    2437    public function tear_down() {
    2538        foreach ( get_all_registered_block_bindings_sources() as $source_name => $source_properties ) {
    26             if ( str_starts_with( $source_name, 'test/' ) ) {
    27                 unregister_block_bindings_source( $source_name );
    28             }
     39            unregister_block_bindings_source( $source_name );
    2940        }
    3041
Note: See TracChangeset for help on using the changeset viewer.