[wp-trac] [WordPress Trac] #49615: Editor: Support filtering arguments in block type registration
WordPress Trac
noreply at wordpress.org
Tue Mar 10 13:41:35 UTC 2020
#49615: Editor: Support filtering arguments in block type registration
-------------------------+-----------------------------
Reporter: aduth | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
Related: https://github.com/WordPress/gutenberg/pull/18414
It is currently not possible to filter the settings of a block type during
its registration. I would propose that this support be added for on the
following basis.
- To enable extensibility. See
[https://github.com/WordPress/gutenberg/pull/18414 Gutenberg#18414] for
one such example, where default block attributes are added automatically
on the basis of [https://developer.wordpress.org/block-editor/developers
/block-api/block-registration/#supports-optional block "supports"].
- For consistency with other `register_` functions.
See prior art:
- https://developer.wordpress.org/reference/hooks/register_post_type_args/
- https://developer.wordpress.org/reference/hooks/register_taxonomy_args/
- https://developer.wordpress.org/reference/hooks/register_meta_args/
The attached patch seeks to follow this pattern:
- Named `register_block_type_args` for consistency with prior art
- Implemented in `WP_Block_Type::set_props`, after `wp_parse_args`, for
consistency with [https://github.com/WordPress/wordpress-
develop/blob/150a49a0b1e1d4e88f6d5d6a94c3c97baac93aac/src/wp-includes
/class-wp-post-type.php#L378-L386 `WP_Post_Type::set_props`]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49615>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list