Skip to content

Commit

Permalink
Fix global style registration logic
Browse files Browse the repository at this point in the history
  • Loading branch information
zaguiini committed Mar 3, 2022
1 parent 1d21e38 commit a0e8182
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions lib/compat/wordpress-6.0/class-wp-webfonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,21 +227,25 @@ private function get_globally_used_webfonts() {
$global_styles = gutenberg_get_global_styles();
$globally_used_webfonts = array();

// Register used fonts from blocks.
foreach ( $global_styles['blocks'] as $setting ) {
$font_family_slug = $this->get_font_family_from_setting( $setting );
if ( isset( $global_styles['blocks'] ) ) {
// Register used fonts from blocks.
foreach ( $global_styles['blocks'] as $setting ) {
$font_family_slug = $this->get_font_family_from_setting( $setting );

if ( $font_family_slug ) {
$globally_used_webfonts[ $font_family_slug ] = 1;
if ( $font_family_slug ) {
$globally_used_webfonts[ $font_family_slug ] = 1;
}
}
}

// Register used fonts from elements.
foreach ( $global_styles['elements'] as $setting ) {
$font_family_slug = $this->get_font_family_from_setting( $setting );
if ( isset( $global_styles['elements'] ) ) {
// Register used fonts from elements.
foreach ( $global_styles['elements'] as $setting ) {
$font_family_slug = $this->get_font_family_from_setting( $setting );

if ( $font_family_slug ) {
$globally_used_webfonts[ $font_family_slug ] = 1;
if ( $font_family_slug ) {
$globally_used_webfonts[ $font_family_slug ] = 1;
}
}
}

Expand Down

0 comments on commit a0e8182

Please sign in to comment.