Make WordPress Core

Changeset 53718


Ignore:
Timestamp:
07/19/2022 01:22:31 PM (3 years ago)
Author:
gziolo
Message:

Editor: Fix register_block_type does not recognise ancestor block setting

When registering block through PHP, using register_block_type function, newly introduced ancestor block setting in block.json was not recognised. It worked though, when block is registered from JavaScript.

Props lovor, annezazu.
Fixes #56184.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks.php

    r53336 r53718  
    287287        'category'        => 'category',
    288288        'parent'          => 'parent',
     289        'ancestor'        => 'ancestor',
    289290        'icon'            => 'icon',
    290291        'description'     => 'description',
  • trunk/tests/phpunit/data/blocks/notice/block.json

    r51599 r53718  
    55    "category": "common",
    66    "parent": [
    7         "core/group"
     7        "tests/group"
     8    ],
     9    "ancestor": [
     10        "tests/section"
    811    ],
    912    "providesContext": {
  • trunk/tests/phpunit/tests/blocks/register.php

    r53268 r53718  
    382382        $this->assertSame( 'Notice', $result->title );
    383383        $this->assertSame( 'common', $result->category );
    384         $this->assertSameSets( array( 'core/group' ), $result->parent );
     384        $this->assertSameSets( array( 'tests/group' ), $result->parent );
     385        $this->assertSameSets( array( 'tests/section' ), $result->ancestor );
    385386        $this->assertSame( 'star', $result->icon );
    386387        $this->assertSame( 'Shows warning, error or success notices…', $result->description );
Note: See TracChangeset for help on using the changeset viewer.