Skip to content

Commit

Permalink
Fix:Nested array for local font which causing disapperience and web f…
Browse files Browse the repository at this point in the history
…ront errors
  • Loading branch information
yssambare12 committed Aug 9, 2023
1 parent afa77e3 commit 6dfa5dd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions includes/class-bcf-google-fonts-compatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,18 @@ public function update_fse_theme_json() {
$local
);
}

$final_font_files_flat = array_reduce($final_font_files, function ($carry, $item) {
return array_merge($carry, is_array($item) ? $item : [$item]);
}, []);

// Add each variant as one font face.
$new_font_faces[] = array(
'fontFamily' => $font_family,
'fontStretch' => '',
'fontStyle' => $font_style,
'fontWeight' => $font_weight,
'src' => $final_font_files,
);
'src' => $final_font_files_flat,
);
}
$this->add_or_update_theme_font_faces( $font_family, $font_slug, $new_font_faces );
}
Expand Down

0 comments on commit 6dfa5dd

Please sign in to comment.