Skip to content

Commit

Permalink
Clarify error message if duotone color values is incorrect (WordPress…
Browse files Browse the repository at this point in the history
…#51397)

* Clarify error message if duotone color values is incorrect

* Add period

* Update message
  • Loading branch information
t-hamano authored and sethrubenstein committed Jul 13, 2023
1 parent 7d3c398 commit 1de97d4
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/class-wp-duotone-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,19 @@ private static function get_filter_svg( $filter_id, $colors ) {
foreach ( $colors as $color_str ) {
$color = self::colord_parse( $color_str );

$duotone_values['r'][] = $color['r'] / 255;
$duotone_values['g'][] = $color['g'] / 255;
$duotone_values['b'][] = $color['b'] / 255;
$duotone_values['a'][] = $color['a'];
if ( null === $color ) {
$error_message = sprintf(
/* translators: %s: duotone colors */
__( '"%s" in theme.json settings.color.duotone is not a hex or rgb string.', 'gutenberg' ),
$color_str
);
_doing_it_wrong( __METHOD__, $error_message, '6.3.0' );
} else {
$duotone_values['r'][] = $color['r'] / 255;
$duotone_values['g'][] = $color['g'] / 255;
$duotone_values['b'][] = $color['b'] / 255;
$duotone_values['a'][] = $color['a'];
}
}

ob_start();
Expand Down

0 comments on commit 1de97d4

Please sign in to comment.