Skip to content

Commit cb56405

Browse files
Themes: Add theme support for appearance tools.
Reapplies the patch reverted in #57649 as the original patch was no longer applying cleanly. Adds theme support for appearance tools to `WP_Theme_JSON_Resolver`. Props andrewserong, mukesh27, noisysocks. Fixes #60118. git-svn-id: https://develop.svn.wordpress.org/trunk@57255 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 15b5be2 commit cb56405

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/wp-includes/class-wp-theme-json-resolver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,11 @@ public static function get_theme_data( $deprecated = array(), $options = array()
327327
$theme_support_data['settings']['border']['style'] = true;
328328
$theme_support_data['settings']['border']['width'] = true;
329329
}
330+
331+
// Allow themes to enable appearance tools via theme_support.
332+
if ( current_theme_supports( 'appearance-tools' ) ) {
333+
$theme_support_data['settings']['appearanceTools'] = true;
334+
}
330335
}
331336
$with_theme_supports = new WP_Theme_JSON( $theme_support_data );
332337
$with_theme_supports->merge( static::$theme );

tests/phpunit/tests/theme/wpThemeJsonResolver.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,9 @@ public function data_get_core_data() {
433433

434434
/**
435435
* @ticket 54336
436+
* @ticket 60118
437+
*
438+
* @covers ::add_theme_support
436439
*/
437440
public function test_add_theme_supports_are_loaded_for_themes_without_theme_json() {
438441
switch_theme( 'default' );
@@ -455,15 +458,18 @@ public function test_add_theme_supports_are_loaded_for_themes_without_theme_json
455458
);
456459
add_theme_support( 'editor-color-palette', $color_palette );
457460
add_theme_support( 'custom-line-height' );
461+
add_theme_support( 'appearance-tools' );
458462

459463
$settings = WP_Theme_JSON_Resolver::get_theme_data()->get_settings();
460464

461465
remove_theme_support( 'custom-line-height' );
462466
remove_theme_support( 'editor-color-palette' );
467+
remove_theme_support( 'appearance-tools' );
463468

464469
$this->assertFalse( wp_theme_has_theme_json() );
465470
$this->assertTrue( $settings['typography']['lineHeight'] );
466471
$this->assertSame( $color_palette, $settings['color']['palette']['theme'] );
472+
$this->assertTrue( $settings['border']['color'], 'Support for "appearance-tools" was not added.' );
467473
}
468474

469475
/**

0 commit comments

Comments
 (0)