Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font Library: Rename the slug of the google fonts collection from 'default-font-collection' to 'google-fonts' #58331

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading