mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-07 09:49:04 +00:00
Editor: Extend register_block_type to accept the path file or folder with block.json
Rather than using two distinct methods to register block types in WordPress core, let's make `register_block_type` the canonical method to deal with all use cases. In practice, the patch proposed extends its usage to work as a proxy to `register_block_type_from_metadata`. It should remove some confusion that we observed and let us be more explicit what's the latest recommendation. Props matveb, mcsf. Fixes #53233. git-svn-id: https://develop.svn.wordpress.org/trunk@50927 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -382,6 +382,18 @@ class WP_Test_Block_Register extends WP_UnitTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 53233
|
||||
*/
|
||||
function test_block_register_block_type_proxy_for_metadata() {
|
||||
$result = register_block_type(
|
||||
DIR_TESTDATA . '/blocks/notice'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf( 'WP_Block_Type', $result );
|
||||
$this->assertSame( 'tests/notice', $result->name );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 52301
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user