Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cache core data if blocks have not changed
  • Loading branch information
oandregal committed Oct 10, 2022
commit cb15514894fc057f7962df20f2010c3e1f92ca09
5 changes: 5 additions & 0 deletions src/wp-includes/class-wp-theme-json-resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class WP_Theme_JSON_Resolver {
* @var array
*/
protected static $blocks_meta = array(
'core' => array(),
'theme' => array(),
);

Expand Down Expand Up @@ -155,6 +156,10 @@ protected static function translate( $theme_json, $domain = 'default' ) {
* @return WP_Theme_JSON Entity that holds core data.
*/
public static function get_core_data() {
if ( null !== static::$core && static::has_same_registered_blocks( 'core' ) ) {
return static::$core;
}

$config = static::read_json_file( __DIR__ . '/theme.json' );
$config = static::translate( $config );

Expand Down