mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@53718 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -286,6 +286,7 @@ function register_block_type_from_metadata( $file_or_folder, $args = array() ) {
|
||||
'title' => 'title',
|
||||
'category' => 'category',
|
||||
'parent' => 'parent',
|
||||
'ancestor' => 'ancestor',
|
||||
'icon' => 'icon',
|
||||
'description' => 'description',
|
||||
'keywords' => 'keywords',
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
"title": "Notice",
|
||||
"category": "common",
|
||||
"parent": [
|
||||
"core/group"
|
||||
"tests/group"
|
||||
],
|
||||
"ancestor": [
|
||||
"tests/section"
|
||||
],
|
||||
"providesContext": {
|
||||
"tests/message": "message"
|
||||
|
||||
@@ -381,7 +381,8 @@ class Tests_Blocks_Register extends WP_UnitTestCase {
|
||||
$this->assertSame( 'tests/notice', $result->name );
|
||||
$this->assertSame( 'Notice', $result->title );
|
||||
$this->assertSame( 'common', $result->category );
|
||||
$this->assertSameSets( array( 'core/group' ), $result->parent );
|
||||
$this->assertSameSets( array( 'tests/group' ), $result->parent );
|
||||
$this->assertSameSets( array( 'tests/section' ), $result->ancestor );
|
||||
$this->assertSame( 'star', $result->icon );
|
||||
$this->assertSame( 'Shows warning, error or success notices…', $result->description );
|
||||
$this->assertSameSets( array( 'alert', 'message' ), $result->keywords );
|
||||
|
||||
Reference in New Issue
Block a user