Make WordPress Core


Ignore:
Timestamp:
11/06/2023 02:45:28 PM (16 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/tests/phpunit/tests/blocks/wpBlock.php

    r56559 r57068  
    6060    /**
    6161     * @ticket 49927
     62     * @ticket 59797
    6263     */
    6364    public function test_constructor_assigns_block_type_from_registry() {
     
    8485                ),
    8586                'lock'      => array( 'type' => 'object' ),
     87                'metadata'  => array( 'type' => 'object' ),
    8688            ),
    8789            $block->block_type->attributes
Note: See TracChangeset for help on using the changeset viewer.