Skip to content

Commit

Permalink
Theme JSON resolver: read theme.json files from the styles/ folder on…
Browse files Browse the repository at this point in the history
…ly once (#62638)

Cache reading theme.json files from styles/ folder.

Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org>
  • Loading branch information
3 people authored Jun 18, 2024
1 parent 54586ee commit f45aa20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/class-wp-theme-json-resolver-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ public static function get_style_variations( $scope = 'theme' ) {
}
ksort( $variation_files );
foreach ( $variation_files as $path => $file ) {
$decoded_file = wp_json_file_decode( $path, array( 'associative' => true ) );
$decoded_file = self::read_json_file( $path );
if ( is_array( $decoded_file ) && static::style_variation_has_scope( $decoded_file, $scope ) ) {
$translated = static::translate( $decoded_file, wp_get_theme()->get( 'TextDomain' ) );
$variation = ( new WP_Theme_JSON_Gutenberg( $translated ) )->get_raw_data();
Expand Down

0 comments on commit f45aa20

Please sign in to comment.