wp_register_duotone_support

The timeline below displays how wordpress function wp_register_duotone_support has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Registers the style and colors block attributes for block types that support it.
 *
 * @since 5.8.0
 * @deprecated 6.3.0 Use WP_Duotone::register_duotone_support() instead.
 *
 * @access private
 *
 * @param WP_Block_Type $block_type Block Type.
 */
function wp_register_duotone_support($block_type)
{
    _deprecated_function(__FUNCTION__, '6.3.0', 'WP_Duotone::register_duotone_support()');
    return WP_Duotone::register_duotone_support($block_type);
}

WordPress Version: 5.8

/**
 * Registers the style and colors block attributes for block types that support it.
 *
 * @since 5.8.0
 * @access private
 *
 * @param WP_Block_Type $block_type Block Type.
 */
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');
        }
    }
}