Skip to content

Commit

Permalink
Better error message when theme.json styles use a duotone preset not …
Browse files Browse the repository at this point in the history
…in settings (#50714)

* Show a more specific error when theme.json styles use a preset not from settings

* Remove the period in the error message

* Add gutenberg domain to translation
  • Loading branch information
Alex Lende authored May 19, 2023
1 parent 3b71878 commit 5584713
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/class-wp-duotone-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,15 @@ private static function enqueue_custom_filter( $filter_id, $duotone_selector, $f
* @param string $filter_value The filter CSS value. e.g. 'url(#wp-duotone-blue-orange)' or 'unset'.
*/
private static function enqueue_global_styles_preset( $filter_id, $duotone_selector, $filter_value ) {
if ( ! array_key_exists( $filter_id, self::$global_styles_presets ) ) {
$error_message = sprintf(
/* translators: %s: duotone filter ID */
__( 'The duotone id "%s" is not registered in theme.json settings', 'gutenberg' ),
$filter_id
);
_doing_it_wrong( __METHOD__, $error_message, '6.3.0' );
return;
}
self::$used_global_styles_presets[ $filter_id ] = self::$global_styles_presets[ $filter_id ];
self::enqueue_custom_filter( $filter_id, $duotone_selector, $filter_value, self::$global_styles_presets[ $filter_id ] );
}
Expand Down

1 comment on commit 5584713

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 5584713.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5027865634
📝 Reported issues:

Please sign in to comment.