Make WordPress Core


Ignore:
Timestamp:
11/06/2023 02:45:28 PM (10 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/rest-api/rest-block-type-controller.php

    r56649 r57068  
    199199     * @ticket 57585
    200200     * @ticket 59346
     201     * @ticket 59797
    201202     */
    202203    public function test_get_item_invalid() {
     
    243244        $this->assertSameSetsWithIndex(
    244245            array(
    245                 'lock' => array( 'type' => 'object' ),
     246                'lock'     => array( 'type' => 'object' ),
     247                'metadata' => array( 'type' => 'object' ),
    246248            ),
    247249            $data['attributes']
     
    273275     * @ticket 57585
    274276     * @ticket 59346
     277     * @ticket 59797
    275278     */
    276279    public function test_get_item_defaults() {
     
    317320        $this->assertSameSetsWithIndex(
    318321            array(
    319                 'lock' => array( 'type' => 'object' ),
     322                'lock'     => array( 'type' => 'object' ),
     323                'metadata' => array( 'type' => 'object' ),
    320324            ),
    321325            $data['attributes']
Note: See TracChangeset for help on using the changeset viewer.