Skip to content

Commit

Permalink
Reapply appearance-tools theme support from WordPress#3846
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Dec 22, 2023
1 parent d1faee9 commit a574433
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/wp-includes/class-wp-theme-json-resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,11 @@ public static function get_theme_data( $deprecated = array(), $options = array()
$theme_support_data['settings']['border']['style'] = true;
$theme_support_data['settings']['border']['width'] = true;
}

// 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 );
Expand Down
6 changes: 6 additions & 0 deletions tests/phpunit/tests/theme/wpThemeJsonResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@ public function data_get_core_data() {

/**
* @ticket 54336
* @ticket 60118
*
* @covers ::add_theme_support
*/
public function test_add_theme_supports_are_loaded_for_themes_without_theme_json() {
switch_theme( 'default' );
Expand All @@ -455,15 +458,18 @@ public function test_add_theme_supports_are_loaded_for_themes_without_theme_json
);
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' );
add_theme_support( 'appearance-tools' );

$this->assertFalse( wp_theme_has_theme_json() );
$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.' );
}

/**
Expand Down

0 comments on commit a574433

Please sign in to comment.