Skip to content

Commit

Permalink
Make $theme static
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Feb 5, 2021
1 parent acf1543 commit 469cb6c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/class-wp-theme-json-resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class WP_Theme_JSON_Resolver {
*
* @var WP_Theme_JSON
*/
private $theme = null;
private static $theme = null;

/**
* Container for data coming from the user.
Expand Down Expand Up @@ -273,22 +273,22 @@ private static function get_core_origin() {
* @return WP_Theme_JSON Entity that holds theme data.
*/
public function get_theme_data( $theme_support_data = array() ) {
if ( null === $this->theme ) {
if ( null === self::$theme ) {
$theme_json_data = self::get_from_file( locate_template( 'experimental-theme.json' ) );
self::translate_presets( $theme_json_data, wp_get_theme()->get( 'TextDomain' ) );
$this->theme = new WP_Theme_JSON( $theme_json_data );
self::$theme = new WP_Theme_JSON( $theme_json_data );
}

if ( empty( $theme_support_data ) ) {
return $this->theme;
return self::$theme;
}

/*
* We want the presets and settings declared in theme.json
* to override the ones declared via add_theme_support.
*/
$with_theme_supports = new WP_Theme_JSON( $theme_support_data );
$with_theme_supports->merge( $this->theme );
$with_theme_supports->merge( self::$theme );

return $with_theme_supports;
}
Expand Down

0 comments on commit 469cb6c

Please sign in to comment.