[wp-trac] [WordPress Trac] #53233: Editor: Extend `register_block_type` to accept the path file or folder with `block.json`
WordPress Trac
noreply at wordpress.org
Wed May 19 11:53:45 UTC 2021
#53233: Editor: Extend `register_block_type` to accept the path file or folder with
`block.json`
-------------------------+-------------------------------------------------
Reporter: gziolo | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 5.8
Component: Editor | Version: trunk
Severity: normal | Keywords: has-patch has-dev-note has-unit-
Focuses: | tests
-------------------------+-------------------------------------------------
The idea comes from @matveb. 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.
From now on, we should always promote combining `block.json` file with
`register_block_type` call:
{{{
register_block_type( __DIR__ );
}}}
In the example above, it will register the block from the metadata stored
in `block.json` that is located in the same folder as the PHP script that
calls the method.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53233>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list