-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
[Feature] Font Library[Type] DiscussionFor issues that are high-level and not yet ready to implement.For issues that are high-level and not yet ready to implement.[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Description
Font collections are registered with a slug that is used as a unique identifier for the collection.
For example:
wp_register_font_collection( 'my-collection, ... )
I now reference that collection by its slug in PHP or using the REST API:
WP_Font_Library::get_font_collection( 'my-collection')wp/v2/font-collections/my-colleciton
Collection slugs are sanitized with sanitize_title to create slugs that are url safe values appropriate to use as identifiers.
The question came up in this wordpress-develop PR, what is the appropriate level of error handling when a slug is invalid (the sanitized slug value does not match it's given value)?
Some possibilities include
- Triggering a
_doing_it_wrongnotice (this is what we're doing at the moment) - Throwing an exception, which would error the entire request
- Storing a
WP_Errorinstance somewhere and returning it at an appropriate time (perhaps when retrieving the slug?)
Metadata
Metadata
Assignees
Labels
[Feature] Font Library[Type] DiscussionFor issues that are high-level and not yet ready to implement.For issues that are high-level and not yet ready to implement.[Type] EnhancementA suggestion for improvement.A suggestion for improvement.