Skip to content

Commit

Permalink
Rename the slug of the google fonts collection from 'default-font-col…
Browse files Browse the repository at this point in the history
…lection' to 'google-fonts'. (#58331)

No behaviour change is added. Only the slug name is updated.
  • Loading branch information
matiasbenedetto authored Jan 26, 2024
1 parent 208f44d commit 9578f0d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/experimental/fonts/font-library/font-library.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ function wp_unregister_font_collection( $collection_id ) {

}

$default_font_collection = array(
'slug' => 'default-font-collection',
$google_fonts = array(
'slug' => 'google-fonts',
'name' => 'Google Fonts',
'description' => __( 'Add from Google Fonts. Fonts are copied to and served from your site.', 'gutenberg' ),
'src' => 'https://s.w.org/images/fonts/17.6/collections/google-fonts-with-preview.json',
);

wp_register_font_collection( $default_font_collection );
wp_register_font_collection( $google_fonts );

// @core-merge: This code should probably go into Core's src/wp-includes/functions.php.
if ( ! function_exists( 'wp_get_font_dir' ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ const DEFAULT_CATEGORY = {
name: __( 'All' ),
};
function FontCollection( { slug } ) {
const requiresPermission = slug === 'default-font-collection';
const requiresPermission = slug === 'google-fonts';

const getGoogleFontsPermissionFromStorage = () => {
return (
window.localStorage.getItem(
'wp-font-library-default-font-collection-permission'
'wp-font-library-google-fonts-permission'
) === 'true'
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function GoogleFontsConfirmDialog() {
const handleConfirm = () => {
// eslint-disable-next-line no-undef
window.localStorage.setItem(
'wp-font-library-default-font-collection-permission',
'wp-font-library-google-fonts-permission',
'true'
);
window.dispatchEvent( new Event( 'storage' ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const tabsFromCollections = ( collections ) =>
collections.map( ( { slug, name } ) => ( {
id: slug,
title:
collections.length === 1 && slug === 'default-font-collection'
collections.length === 1 && slug === 'google-fonts'
? __( 'Install Fonts' )
: name,
} ) );
Expand Down

0 comments on commit 9578f0d

Please sign in to comment.