Browse Source

BCB: Fix PHP warnings

Ben Dwyer 4 years ago
parent
commit
0d7ec66c8b
1 changed files with 8 additions and 1 deletions
  1. 8 1
      blank-canvas-blocks/functions.php

+ 8 - 1
blank-canvas-blocks/functions.php

@@ -59,8 +59,15 @@ add_action( 'wp_enqueue_scripts', 'blank_canvas_blocks_scripts' );
 
 
 function blank_canvas_blocks_fonts_url() {
 function blank_canvas_blocks_fonts_url() {
 	$fonts_url = '';
 	$fonts_url = '';
+	if ( ! class_exists( 'WP_Theme_JSON_Resolver' ) ) {
+		return '';
+	}
+
+	$theme_data = WP_Theme_JSON_Resolver::get_merged_data()->get_settings();
+	if ( empty( $theme_data ) || empty( $theme_data['defaults'] ) || empty( $theme_data['defaults']['custom'] ) ) {
+		return '';
+	}
 
 
-	$theme_data  = WP_Theme_JSON_Resolver::get_merged_data()->get_settings();
 	$custom_data = $theme_data['defaults']['custom'];
 	$custom_data = $theme_data['defaults']['custom'];
 	if ( array_key_exists( 'fontsToLoadFromGoogle', $custom_data ) ) {
 	if ( array_key_exists( 'fontsToLoadFromGoogle', $custom_data ) ) {
 		$font_families = $theme_data['defaults']['custom']['fontsToLoadFromGoogle'];
 		$font_families = $theme_data['defaults']['custom']['fontsToLoadFromGoogle'];