mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Themes: Add opt-in Appearance Tools support for Classic Themes.
This changeset merges the following changes from Gutenberg repository: - Allow themes without `theme.json` to opt-in to appearance tools via `add_theme_support( 'appearance-tools' );` - Update `wpThemeJsonResolver` unit tests accordingly See the following pull request for more info: https://github.com/WordPress/gutenberg/pull/43337 Props ironprogrammer, audrasjb. Fixes #57460. git-svn-id: https://develop.svn.wordpress.org/trunk@55067 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c17a4760b7
commit
cb87135103
@ -322,6 +322,11 @@ class WP_Theme_JSON_Resolver {
|
||||
|
||||
// Classic themes without a theme.json don't support global duotone.
|
||||
$theme_support_data['settings']['color']['defaultDuotone'] = false;
|
||||
|
||||
// Allow themes to enable appearance tools via theme_support.
|
||||
if ( current_theme_supports( 'appearance-tools' ) ) {
|
||||
$theme_support_data['settings']['appearanceTools'] = true;
|
||||
}
|
||||
}
|
||||
$with_theme_supports = new WP_Theme_JSON( $theme_support_data );
|
||||
$with_theme_supports->merge( static::$theme );
|
||||
|
||||
@ -449,6 +449,9 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 54336
|
||||
* @ticket 56467
|
||||
*
|
||||
* @covers ::add_theme_support
|
||||
*/
|
||||
public function test_add_theme_supports_are_loaded_for_themes_without_theme_json() {
|
||||
switch_theme( 'default' );
|
||||
@ -471,15 +474,18 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
|
||||
);
|
||||
add_theme_support( 'editor-color-palette', $color_palette );
|
||||
add_theme_support( 'custom-line-height' );
|
||||
add_theme_support( 'appearance-tools' );
|
||||
|
||||
$settings = WP_Theme_JSON_Resolver::get_theme_data()->get_settings();
|
||||
|
||||
remove_theme_support( 'custom-line-height' );
|
||||
remove_theme_support( 'editor-color-palette' );
|
||||
remove_theme_support( 'appearance-tools' );
|
||||
|
||||
$this->assertFalse( WP_Theme_JSON_Resolver::theme_has_support() );
|
||||
$this->assertTrue( $settings['typography']['lineHeight'] );
|
||||
$this->assertSame( $color_palette, $settings['color']['palette']['theme'] );
|
||||
$this->assertTrue( $settings['border']['color'], 'Support for appearance-tools was not added.' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user