Block Types: Add `metadata` global attribute.

Add a new global attribute (i.e. an attribute that can be added to all and any blocks) called `metadata`. This is required for use cases such as allowing the user to assign custom names to blocks, or for making Block Hooks work with user-modified templates/parts/patterns (#59646).

Props Mamaduka, gziolo, get_dave.
Fixes #59797.
Built from https://develop.svn.wordpress.org/trunk@57068


git-svn-id: http://core.svn.wordpress.org/trunk@56579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Bernhard Reiter 2023-11-06 14:47:18 +00:00
parent ea9d0c8dce
commit 388713f0ff
2 changed files with 5 additions and 3 deletions

View File

@ -242,11 +242,13 @@ class WP_Block_Type {
/**
* Attributes supported by every block.
*
* @since 6.0.0
* @since 6.0.0 Added `lock`.
* @since 6.5.0 Added `metadata`.
* @var array
*/
const GLOBAL_ATTRIBUTES = array(
'lock' => array( 'type' => 'object' ),
'lock' => array( 'type' => 'object' ),
'metadata' => array( 'type' => 'object' ),
);
/**

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.5-alpha-57067';
$wp_version = '6.5-alpha-57068';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.