Skip to content

Commit

Permalink
Deprecate WP_Theme_JSON_Resolver:theme_has_support() (#45380)
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Oct 28, 2022
1 parent df98b4b commit 67fe26f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
35 changes: 35 additions & 0 deletions lib/compat/wordpress-6.2/class-wp-theme-json-resolver-6-2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* WP_Theme_JSON_Resolver_6_1 class
*
* @package gutenberg
*/

/**
* Class that abstracts the processing of the different data sources
* for site-level config and offers an API to work with them.
*
* This class is for internal core usage and is not supposed to be used by extenders (plugins and/or themes).
* This is a low-level API that may need to do breaking changes. Please,
* use get_global_settings, get_global_styles, and get_global_stylesheet instead.
*
* @access private
*/
class WP_Theme_JSON_Resolver_6_2 extends WP_Theme_JSON_Resolver_6_1 {

/**
* Determines whether the active theme has a theme.json file.
*
* @since 5.8.0
* @since 5.9.0 Added a check in the parent theme.
* @deprecated 6.2.0 Use wp_theme_has_theme_json() instead.
*
* @return bool
*/
public static function theme_has_support() {
_deprecated_function( __METHOD__, '6.2.0', 'wp_theme_has_theme_json()' );

return wp_theme_has_theme_json();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @access private
*/
class WP_Theme_JSON_Resolver_Gutenberg extends WP_Theme_JSON_Resolver_6_1 {
class WP_Theme_JSON_Resolver_Gutenberg extends WP_Theme_JSON_Resolver_6_2 {
/**
* Returns the theme's data.
*
Expand Down
5 changes: 3 additions & 2 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-6.1/block-editor-settings.php';
require __DIR__ . '/compat/wordpress-6.1/persisted-preferences.php';
require __DIR__ . '/compat/wordpress-6.1/get-global-styles-and-settings.php';
require __DIR__ . '/compat/wordpress-6.2/get-global-styles-and-settings.php';
require __DIR__ . '/compat/wordpress-6.2/default-filters.php';
require __DIR__ . '/compat/wordpress-6.1/class-wp-theme-json-data-gutenberg.php';
require __DIR__ . '/compat/wordpress-6.1/class-wp-theme-json-6-1.php';
require __DIR__ . '/compat/wordpress-6.1/class-wp-theme-json-resolver-6-1.php';
Expand All @@ -104,6 +102,9 @@ function gutenberg_is_experiment_enabled( $name ) {

// WordPress 6.2 compat.
require __DIR__ . '/compat/wordpress-6.2/script-loader.php';
require __DIR__ . '/compat/wordpress-6.2/get-global-styles-and-settings.php';
require __DIR__ . '/compat/wordpress-6.2/default-filters.php';
require __DIR__ . '/compat/wordpress-6.2/class-wp-theme-json-resolver-6-2.php';

// Experimental features.
remove_action( 'plugins_loaded', '_wp_theme_json_webfonts_handler' ); // Turns off WP 6.0's stopgap handler for Webfonts API.
Expand Down

0 comments on commit 67fe26f

Please sign in to comment.