Make WordPress Core

Changeset 57558


Ignore:
Timestamp:
02/08/2024 07:36:36 AM (8 months ago)
Author:
youknowriad
Message:

Editor: Register the Google Font collection.

By default, users will see a tab in the editor indicating the possibility
to active Google Fonts and install Fonts from there.

Props youknowriad, get_dave, mcsf.
Fixes #59166.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-filters.php

    r57539 r57558  
    751751add_action( 'deleted_post', '_wp_after_delete_font_family', 10, 2 );
    752752add_action( 'before_delete_post', '_wp_before_delete_font_face', 10, 2 );
     753add_action( 'init', '_wp_register_default_font_collections' );
    753754
    754755unset( $filter, $action );
  • trunk/src/wp-includes/fonts.php

    r57539 r57558  
    189189    }
    190190}
     191
     192/**
     193 * Register the default font collections.
     194 *
     195 * @access private
     196 * @since 6.5.0
     197 */
     198function _wp_register_default_font_collections() {
     199    wp_register_font_collection( 'google-fonts', 'https://s.w.org/images/fonts/17.7/collections/google-fonts-with-preview.json' );
     200}
  • trunk/tests/phpunit/includes/functions.php

    r57514 r57558  
    352352}
    353353tests_add_filter( 'init', '_unhook_block_registration', 1000 );
     354
     355/**
     356 * After the init action has been run once, trying to re-register font collections can cause
     357 * errors. To avoid this, unhook the font registration functions.
     358 *
     359 * @since 6.5.0
     360 */
     361function _unhook_font_registration() {
     362    remove_action( 'init', '_wp_register_default_font_collections' );
     363}
     364tests_add_filter( 'init', '_unhook_font_registration', 1000 );
Note: See TracChangeset for help on using the changeset viewer.