wp_register_duotone_support

函数


wp_register_duotone_support ( $block_type )
Access
Private
参数
  • (WP_Block_Type)
    $block_type
    Block Type.
    Required:
定义位置
  • wp-includes/block-supports/duotone.php
    , line 480
引入
5.8.0
弃用

为支持它的区块类型注册样式和颜色区块属性。

function wp_register_duotone_support( $block_type ) {
	$has_duotone_support = false;
	if ( property_exists( $block_type, 'supports' ) ) {
		$has_duotone_support = _wp_array_get( $block_type->supports, array( 'color', '__experimentalDuotone' ), false );
	}

	if ( $has_duotone_support ) {
		if ( ! $block_type->attributes ) {
			$block_type->attributes = array();
		}

		if ( ! array_key_exists( 'style', $block_type->attributes ) ) {
			$block_type->attributes['style'] = array(
				'type' => 'object',
			);
		}
	}
}