-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Font Library: font collection refactor to use the new schema #57884
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
Changes from all commits
6ca902d
9e3c3f8
78c6941
399cf88
b600531
adaebd6
2e57945
cc7067f
8fe9713
9f4cfe2
8dcdcf2
823a580
6dff6f1
778d27b
3c011c8
e698680
3a5b423
6f9463b
9d1d78b
ed27754
ae2f519
21b21d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,11 +62,17 @@ public static function get_expected_font_mime_types_per_php_version( $php_versio | |
| * @return WP_Font_Collection|WP_Error A font collection is it was registered successfully and a WP_Error otherwise. | ||
| */ | ||
| public static function register_font_collection( $config ) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For both
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implemented in this PR: #58269 |
||
| if ( ! WP_Font_Collection::is_config_valid( $config ) ) { | ||
| $error_message = __( 'Font collection config is invalid.', 'gutenberg' ); | ||
| return new WP_Error( 'font_collection_registration_error', $error_message ); | ||
| } | ||
|
|
||
| $new_collection = new WP_Font_Collection( $config ); | ||
| if ( self::is_collection_registered( $config['slug'] ) ) { | ||
|
|
||
| if ( self::is_collection_registered( $new_collection->get_config()['slug'] ) ) { | ||
| $error_message = sprintf( | ||
| /* translators: %s: Font collection slug. */ | ||
| __( 'Font collection with slug: "%s" is already registered.', 'default' ), | ||
| __( 'Font collection with slug: "%s" is already registered.', 'gutenberg' ), | ||
| $config['slug'] | ||
| ); | ||
| _doing_it_wrong( | ||
|
|
@@ -76,7 +82,7 @@ public static function register_font_collection( $config ) { | |
| ); | ||
| return new WP_Error( 'font_collection_registration_error', $error_message ); | ||
| } | ||
| self::$collections[ $config['slug'] ] = $new_collection; | ||
| self::$collections[ $new_collection->get_config()['slug'] ] = $new_collection; | ||
| return $new_collection; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.