Make WordPress Core

Changeset 57255


Ignore:
Timestamp:
01/09/2024 06:24:44 AM (3 months ago)
Author:
isabel_brison
Message:

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.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json-resolver.php

    r56709 r57255  
    327327                $theme_support_data['settings']['border']['style']  = true;
    328328                $theme_support_data['settings']['border']['width']  = true;
     329            }
     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;
    329334            }
    330335        }
  • trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php

    r56559 r57255  
    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() {
     
    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();
     
    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
Note: See TracChangeset for help on using the changeset viewer.