WP_Duotone::register_duotone_support
Registers the style and colors block attributes for block types that support it.
Block support is added with supports.filter.duotone in block.json.
Method of the class: WP_Duotone{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WP_Duotone::register_duotone_support( $block_type );
- $block_type(WP_Block_Type) (required)
- Block Type.
Changelog
| Since 6.3.0 | Introduced. |
WP_Duotone::register_duotone_support() WP Duotone::register duotone support code WP 7.0
public static function register_duotone_support( $block_type ) {
/*
* Previous `color.__experimentalDuotone` support flag is migrated
* to `filter.duotone` via `block_type_metadata_settings` filter.
*/
if ( block_has_support( $block_type, array( 'filter', 'duotone' ), null ) ) {
if ( ! $block_type->attributes ) {
$block_type->attributes = array();
}
if ( ! array_key_exists( 'style', $block_type->attributes ) ) {
$block_type->attributes['style'] = array(
'type' => 'object',
);
}
}
}