Make WordPress Core

Changeset 55067


Ignore:
Timestamp:
01/14/2023 09:34:55 AM (18 months ago)
Author:
audrasjb
Message:

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.

Location:
trunk
Files:
2 edited

Legend:

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

    r54824 r55067  
    323323            // Classic themes without a theme.json don't support global duotone.
    324324            $theme_support_data['settings']['color']['defaultDuotone'] = false;
     325
     326            // Allow themes to enable appearance tools via theme_support.
     327            if ( current_theme_supports( 'appearance-tools' ) ) {
     328                $theme_support_data['settings']['appearanceTools'] = true;
     329            }
    325330        }
    326331        $with_theme_supports = new WP_Theme_JSON( $theme_support_data );
  • trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php

    r54896 r55067  
    450450    /**
    451451     * @ticket 54336
     452     * @ticket 56467
     453     *
     454     * @covers ::add_theme_support
    452455     */
    453456    public function test_add_theme_supports_are_loaded_for_themes_without_theme_json() {
     
    472475        add_theme_support( 'editor-color-palette', $color_palette );
    473476        add_theme_support( 'custom-line-height' );
     477        add_theme_support( 'appearance-tools' );
    474478
    475479        $settings = WP_Theme_JSON_Resolver::get_theme_data()->get_settings();
     
    477481        remove_theme_support( 'custom-line-height' );
    478482        remove_theme_support( 'editor-color-palette' );
     483        remove_theme_support( 'appearance-tools' );
    479484
    480485        $this->assertFalse( WP_Theme_JSON_Resolver::theme_has_support() );
    481486        $this->assertTrue( $settings['typography']['lineHeight'] );
    482487        $this->assertSame( $color_palette, $settings['color']['palette']['theme'] );
     488        $this->assertTrue( $settings['border']['color'], 'Support for appearance-tools was not added.' );
    483489    }
    484490
Note: See TracChangeset for help on using the changeset viewer.