public static function render_duotone_support( $block_content,
$block,
$wp_block ) { if ( empty( $block_content ) || !
$block['blockName'
] ) { return $block_content;
} $duotone_selector = self::
get_selector( $wp_block->block_type
);
if ( !
$duotone_selector ) { return $block_content;
} $global_styles_block_names = self::
get_all_global_style_block_names();
// The block should have a duotone attribute or have duotone defined in its theme.json to be processed.
$has_duotone_attribute =
isset( $block['attrs'
]['style'
]['color'
]['duotone'
] );
$has_global_styles_duotone =
array_key_exists( $block['blockName'
],
$global_styles_block_names );
if ( !
$has_duotone_attribute && !
$has_global_styles_duotone ) { return $block_content;
} // Generate the pieces needed for rendering a duotone to the page.
if ( $has_duotone_attribute ) {