Make WordPress Core


Ignore:
Timestamp:
11/06/2023 02:45:28 PM (6 months ago)
Author:
Bernhard Reiter
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-block-type.php

    r56587 r57068  
    243243     * Attributes supported by every block.
    244244     *
    245      * @since 6.0.0
     245     * @since 6.0.0 Added `lock`.
     246     * @since 6.5.0 Added `metadata`.
    246247     * @var array
    247248     */
    248249    const GLOBAL_ATTRIBUTES = array(
    249         'lock' => array( 'type' => 'object' ),
     250        'lock'     => array( 'type' => 'object' ),
     251        'metadata' => array( 'type' => 'object' ),
    250252    );
    251253
Note: See TracChangeset for help on using the changeset viewer.