Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Import the fonts selected as default on the customizer.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
$fonts_to_print = array();

$this->collect_global_styles_fonts();
$this->collect_selected_fonts();
$fonts_in_use = array_values( array_unique( $this->fonts_in_use, SORT_STRING ) );
$fonts_in_use = array_map(
function ( $font_slug ) use ( $font_slug_aliases ) {
Expand All @@ -86,6 +87,30 @@
}
}

/**
* Collect fonts selected in the Jetpack Fonts module.
*/
public function collect_selected_fonts() {
if ( ! class_exists( '\Jetpack_Fonts' ) ) {
return;
}

$jetpack_fonts_instance = \Jetpack_Fonts::get_instance();

$selected_fonts = array_unique(
array_map(
function ( $font ) {
return $this->format_font( $font['cssName'] );
},
(array) $jetpack_fonts_instance->get( 'selected_fonts' )

Check failure on line 105 in projects/plugins/jetpack/modules/google-fonts/current/class-jetpack-google-font-face.php

View workflow job for this annotation

GitHub Actions / Static analysis

UndefError PhanUndeclaredMethod Call to undeclared method \Jetpack_Fonts::get Suggestion: Did you mean expr::get_instance() FAQ on Phan issues: pdWQjU-Jb-p2
)
);

foreach ( $selected_fonts as $font_slug ) {
$this->add_font( $font_slug );
}
}

/**
* Collect fonts used for global styles settings.
*/
Expand Down
Loading