From ca241962334ecb339b31fcffbe33674d67b015e5 Mon Sep 17 00:00:00 2001 From: Isabel Brison Date: Wed, 10 Jan 2024 00:25:19 +0000 Subject: [PATCH] Editor: Allow default duotone styles if not explicitly disabled in theme.json. Removes setting that disabled default duotone palette from being output in themes without theme.json. Props andrewserong. Fixes #60136. git-svn-id: https://develop.svn.wordpress.org/trunk@57260 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-theme-json-resolver.php | 3 --- .../phpunit/tests/theme/wpThemeJsonResolver.php | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/class-wp-theme-json-resolver.php b/src/wp-includes/class-wp-theme-json-resolver.php index 5a785612ce185..44db8364f1092 100644 --- a/src/wp-includes/class-wp-theme-json-resolver.php +++ b/src/wp-includes/class-wp-theme-json-resolver.php @@ -312,9 +312,6 @@ public static function get_theme_data( $deprecated = array(), $options = array() } $theme_support_data['settings']['color']['defaultGradients'] = $default_gradients; - // Classic themes without a theme.json don't support global duotone. - $theme_support_data['settings']['color']['defaultDuotone'] = false; - // Allow themes to enable link color setting via theme_support. if ( current_theme_supports( 'link-color' ) ) { $theme_support_data['settings']['color']['link'] = true; diff --git a/tests/phpunit/tests/theme/wpThemeJsonResolver.php b/tests/phpunit/tests/theme/wpThemeJsonResolver.php index dd5fff2bff8ef..d595b3a908ae1 100644 --- a/tests/phpunit/tests/theme/wpThemeJsonResolver.php +++ b/tests/phpunit/tests/theme/wpThemeJsonResolver.php @@ -472,6 +472,22 @@ public function test_add_theme_supports_are_loaded_for_themes_without_theme_json $this->assertTrue( $settings['border']['color'], 'Support for "appearance-tools" was not added.' ); } + /** + * Tests that classic themes still get core default settings such as color palette and duotone. + * + * @ticket 60136 + */ + public function test_core_default_settings_are_loaded_for_themes_without_theme_json() { + switch_theme( 'default' ); + + $settings = WP_Theme_JSON_Resolver::get_merged_data( 'theme' )->get_settings(); + + $this->assertFalse( wp_theme_has_theme_json() ); + $this->assertTrue( $settings['color']['defaultPalette'] ); + $this->assertTrue( $settings['color']['defaultDuotone'] ); + $this->assertTrue( $settings['color']['defaultGradients'] ); + } + /** * @ticket 54336 * @ticket 56611