Grant Kinney 3 年之前
父節點
當前提交
c6506b47a4
共有 1 個文件被更改,包括 20 次插入2 次删除
  1. 20 2
      blockbase/inc/customizer/wp-customize-fonts.php

+ 20 - 2
blockbase/inc/customizer/wp-customize-fonts.php

@@ -4,17 +4,22 @@ require_once( __DIR__ . '/wp-customize-global-styles-setting.php' );
 require_once( __DIR__ . '/wp-customize-utils.php' );
 
 add_action( 'init', function() {
+  return;
+	// We've already transformed the data, no need to run this
 	if ( get_option( 'blockbase_custom_fonts_data_migrated' ) ) {
 		return;
 	}
-	add_option( 'blockbase_custom_fonts_data_migrated', 1 );
-	
+
+
 	$font_settings = wp_get_global_settings( array( 'typography', 'fontFamilies' ) );
 
+	// No Customizer font settings found. Mark as transformed and hide the Customizer UI for fonts.
 	if ( ! isset( $font_settings['custom'] ) || ! is_array( $font_settings['custom'] ) ) {
+		add_option( 'blockbase_legacy_font_settings', '{}' );
 		return;
 	}
 
+
 	// Extract font slugs from legacy data structure
 	$heading_font_slug = '';
 	$body_font_slug = '';
@@ -90,8 +95,21 @@ add_action( 'init', function() {
 	delete_transient( 'global_styles_' . get_stylesheet() );
 	delete_transient( 'gutenberg_global_styles' );
 	delete_transient( 'gutenberg_global_styles_' . get_stylesheet() );
+	add_option( 'blockbase_legacy_font_settings', 'TODO' );
 } );
 
+function blockbase_supports_jetpack_google_fonts() {
+	if ( defined( 'JETPACK__VERSION' ) ) {
+		$jetpack_has_google_fonts_module = JETPACK__VERSION === 'wpcom' || version_compare( JETPACK__VERSION, '10.9', '>=' );
+	}
+
+	if ( defined( 'GUTENBERG_VERSION' ) ) {
+		$gutenberg_webfonts_api_supports_enqueueing = version_compare( GUTENBERG_VERSION, '13.3', '>=' );
+	}
+
+	return $jetpack_has_google_fonts_module && $gutenberg_webfonts_api_supports_enqueueing && Jetpack::is_module_active( 'google-fonts' );
+}
+
 class GlobalStylesFontsCustomizer {
 
 	private $section_key = 'customize-global-styles-fonts';