Make WordPress Core


Ignore:
Timestamp:
11/06/2023 02:45:28 PM (20 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/register.php

    r57026 r57068  
    727727     * @ticket 50328
    728728     * @ticket 57585
     729     * @ticket 59797
    729730     */
    730731    public function test_block_registers_with_metadata_fixture() {
     
    745746        $this->assertSame(
    746747            array(
    747                 'message' => array(
     748                'message'  => array(
    748749                    'type' => 'string',
    749750                ),
    750                 'lock'    => array( 'type' => 'object' ),
     751                'lock'     => array( 'type' => 'object' ),
     752                'metadata' => array( 'type' => 'object' ),
    751753            ),
    752754            $result->attributes
Note: See TracChangeset for help on using the changeset viewer.