-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Font Collection backend #54098
Conversation
Co-authored-by: Tonya Mork <[email protected]>
Co-authored-by: Tonya Mork <[email protected]>
* Ensures each required param is of the right data type. * Improves each param check error to include expected data type.
* Rechecking if "data_json_file" exists in the $config property shouldn't be necessary, as it's checked in the constructor. * If the file does not exist, bail out immediately as there's nothing more to do. * Adds a check and WP_Error for file_get_contents(): file_get_contents() returns false on failure. If there's nothing in the file, an empty string is returned. This change checks for both of these conditions and returns a WP_Error if either happens. * Internationalizes WP_Error error message for consistency in Core.
Co-authored-by: Tonya Mork <[email protected]>
Co-authored-by: Tonya Mork <[email protected]>
Co-authored-by: Tonya Mork <[email protected]>
This reverts commit 0e6c026.
…n, remove try catch and raise the error if needed
* Renamed files to remove `-test` suffix (no longer needed). * Removed extra empty line before closing the class. * Used Core's `assertWPError()`.
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/experimental/fonts/font-library/class-wp-font-collection.php ❔ phpunit/tests/fonts/font-library/wpFontCollection/__construct.php ❔ phpunit/tests/fonts/font-library/wpFontCollection/getData.php ❔ phpunit/tests/fonts/font-library/wpFontLibrary/getFontCollection.php ❔ phpunit/tests/fonts/font-library/wpFontLibrary/getFontCollections.php ❔ phpunit/tests/fonts/font-library/wpFontLibrary/registerFontCollection.php ❔ phpunit/tests/fonts/font-library/wpRestFontLibraryController/base.php ❔ phpunit/tests/fonts/font-library/wpRestFontLibraryController/getFontCollection.php ❔ phpunit/tests/fonts/font-library/wpRestFontLibraryController/getFontCollections.php ❔ phpunit/tests/fonts/font-library/wpRestFontLibraryController/registerRoutes.php ❔ phpunit/tests/fonts/font-library/wpRestFontLibraryController/uninstallFonts.php ❔ lib/experimental/fonts/font-library/class-wp-font-library.php ❔ lib/experimental/fonts/font-library/class-wp-rest-font-library-controller.php ❔ lib/experimental/fonts/font-library/font-library.php ❔ lib/load.php ❔ phpunit/tests/fonts/font-library/wpFontFamily/base.php ❔ phpunit/tests/fonts/font-library/wpRestFontLibraryController/installFonts.php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coping my code review from PR #53816:
The source code LGTM 👍
The tests are good enough. I'll follow-up with a test improvement PR.
Follow up of the previous PR: #53816
What?
Add extensibility capabilities to the Font Library.
Provides a way to provide collections of typographic fonts by code.
Why?
Example:
This is all the code required to create a plugin providing a font collection.
Download the plugin as zip ready to test:
my-font-collection.zip
How?
WP_Font_Collection
class.wp_register_font_collection
filter./fonts/collections
andfonts/collections/<id>
endpoints.To do
We would need this: WP_Theme_JSON sanitization is not working below certain level of theme.json #52798
Tracking issue:
Stage 1: #52698
Stage 2: #53307