Make WordPress Core


Ignore:
Timestamp:
02/01/2024 12:52:54 PM (8 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/includes/functions.php

    r56472 r57514  
    340340 */
    341341function _unhook_block_registration() {
     342    // Block types.
    342343    require __DIR__ . '/unregister-blocks-hooks.php';
    343344    remove_action( 'init', 'register_core_block_types_from_metadata' );
     
    345346    remove_action( 'init', 'register_block_core_widget_group' );
    346347    remove_action( 'init', 'register_core_block_types_from_metadata' );
     348
     349    // Block binding sources.
     350    remove_action( 'init', '_register_block_bindings_pattern_overrides_source' );
     351    remove_action( 'init', '_register_block_bindings_post_meta_source' );
    347352}
    348353tests_add_filter( 'init', '_unhook_block_registration', 1000 );
Note: See TracChangeset for help on using the changeset viewer.