Skip to content

Commit

Permalink
Always set $handles to false when empty
Browse files Browse the repository at this point in the history
When invoked as a hooked callback, it receives an empty string.
Empty is the same as false.
  • Loading branch information
hellofromtonya committed May 9, 2023
1 parent d9a1151 commit 5017aed
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions lib/experimental/fonts-api/fonts-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,21 +198,17 @@ function wp_print_fonts( $handles = false ) {
return array();
}

if ( false === $handles ) {
if ( empty( $handles ) ) {
// Automatically enqueue all user-selected fonts.
WP_Fonts_Resolver::enqueue_user_selected_fonts();
} else {
// When `true`, print all registered fonts for the iframed editor.
if ( $in_iframed_editor ) {
$queue = $wp_fonts->queue;
$done = $wp_fonts->done;
$wp_fonts->done = array();
$wp_fonts->queue = $registered;
$handles = false;
} elseif ( empty( $handles ) ) {
// When falsey, assign `false` to print enqueued fonts.
$handles = false;
}
$handles = false;
} elseif ( $in_iframed_editor ) {
// Print all registered fonts for the iframed editor.
$queue = $wp_fonts->queue;
$done = $wp_fonts->done;
$wp_fonts->done = array();
$wp_fonts->queue = $registered;
$handles = false;
}

_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
Expand Down

0 comments on commit 5017aed

Please sign in to comment.