Skip to content

Commit

Permalink
Set $handles to true
Browse files Browse the repository at this point in the history
  • Loading branch information
hellofromtonya committed May 2, 2023
1 parent db8368d commit cf9942a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/compat/wordpress-6.2/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function gutenberg_resolve_assets_override() {
// Generate font @font-face styles.
if ( function_exists( 'wp_print_fonts' ) ) {
ob_start();
wp_print_fonts( false, true );
wp_print_fonts( true );
$styles .= ob_get_clean();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/compat/wordpress-6.3/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function _gutenberg_get_iframed_editor_assets() {

ob_start();
wp_print_styles();
wp_print_fonts( false, true );
wp_print_fonts( true );
$styles = ob_get_clean();

ob_start();
Expand Down
13 changes: 6 additions & 7 deletions lib/experimental/fonts-api/fonts-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,14 @@ function wp_register_font_provider( $name, $classname ) {
*
* @since X.X.X
*
* @param string|string[]|false $handles Optional. Items to be processed: queue (false),
* single item (string), or multiple items (array of strings).
* Default false.
* @param bool $for_iframed_editor Optional. Whether the fonts are for iframed editor.
* Default false.
* @param string|string[]|bool $handles Optional. Items to be processed: queue (false),
* for iframed editor assets (true), single item (string),
* or multiple items (array of strings).
* Default false.
* @return array|string[] Array of font handles that have been processed.
* An empty array if none were processed.
*/
function wp_print_fonts( $handles = false, $for_iframed_editor = false ) {
function wp_print_fonts( $handles = false ) {
global $wp_fonts;

if ( empty( $handles ) ) {
Expand All @@ -207,7 +206,7 @@ function wp_print_fonts( $handles = false, $for_iframed_editor = false ) {
}

// Print all registered fonts for the iframed editor.
if ( $for_iframed_editor ) {
if ( true === $handles ) {
$handles = $registered;
}

Expand Down
2 changes: 1 addition & 1 deletion phpunit/fonts-api/wpPrintFonts-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function test_should_print_all_registered_fonts_for_iframed_editor( $font
wp_register_fonts( $fonts );

$this->expectOutputString( $expected['output'] );
$actual_done = wp_print_fonts( false, true );
$actual_done = wp_print_fonts( true );
$this->assertSameSets( $expected['done'], $actual_done, 'All registered font-family handles should be returned' );
}

Expand Down

0 comments on commit cf9942a

Please sign in to comment.