Skip to content

Commit

Permalink
only add properties if they exist in the theme.json
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed Mar 21, 2022
1 parent e5361c5 commit ce5fe20
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/compat/wordpress-6.0/block-template-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,13 @@ function gutenberg_generate_block_templates_export_file() {
if ( file_exists( $theme_path . '/theme.json' ) ) {
$theme_json_data = wp_json_file_decode( $theme_path . '/theme.json', array( 'associative' => true ) );
if ( ! empty( $theme_json_data ) ) {
$merged_data['$schema'] = $theme_json_data['$schema'];
$merged_data['settings']['appearanceTools'] = $theme_json_data['settings']['appearanceTools'];
if ( ! empty( $theme_json_data['$schema'] ) ) {
$merged_data['$schema'] = $theme_json_data['$schema'];
}

if ( ! empty( $theme_json_data['settings']['appearanceTools'] ) ) {
$merged_data['settings']['appearanceTools'] = $theme_json_data['settings']['appearanceTools'];
}
}
}

Expand Down

0 comments on commit ce5fe20

Please sign in to comment.