Editor: Support filtering arguments in block type registration

Adds possibility to filter the settings of a block type during its registration.

Props aduth, azaozz.
Fixes #49615.


Built from https://develop.svn.wordpress.org/trunk@48263


git-svn-id: http://core.svn.wordpress.org/trunk@48032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
gziolo 2020-07-01 13:10:02 +00:00
parent eafcf52d18
commit 9a9352da00
2 changed files with 12 additions and 1 deletions

View File

@ -262,6 +262,17 @@ class WP_Block_Type {
$args['name'] = $this->name; $args['name'] = $this->name;
/**
* Filters the arguments for registering a block type.
*
* @since 5.5.0
*
* @param array $args Array of arguments for registering a
* block type.
* @param string $block_type Block type name including namespace.
*/
$args = apply_filters( 'register_block_type_args', $args, $this->name );
foreach ( $args as $property_name => $property_value ) { foreach ( $args as $property_name => $property_value ) {
$this->$property_name = $property_value; $this->$property_name = $property_value;
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.5-alpha-48262'; $wp_version = '5.5-alpha-48263';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.