FontCollectionsController final readonly class
Minn\Rest\FontCollectionsController · public/minn/src/Minn/Rest/FontCollectionsController.php · 78 lines
wp/v2/font-collections (probe: the font library routes on the reference): the collections registered with the font library, in the order they were registered, a page at a time, and one by its slug. Only someone who may edit theme options reads them, refused as rest_cannot_read. A collection shows its slug, then its name, description, font families and categories as its data holds them, the same in every context, through rest_prepare_font_collection. The reference registers a Google Fonts collection read from wordpress.org; the engine registers none of its own (wp-api/fonts.php), so the list holds what plugins register.
Constants and properties
| private | REFUSAL = 'Sorry, you are not allowed to access font collections.' | |
| private | FIELDS = array ( 0 => 'name', 1 => 'description', 2 => 'font_families', 3 => 'categories', ) | |
| private | readonly Minn\Rest\RestUrl $url | Promoted from the constructor. |
Public
| new | __construct(Minn\Rest\RestUrl $url)# | |
| method | list(Minn\Http\Request $request): Minn\Http\ResponseGET /wp/v2/font-collections (cap edit_theme_options)# | The registered font collections, a page at a time. |
| method | single(Minn\Http\Request $request, string $slug): Minn\Http\ResponseGET /wp/v2/font-collections/{slug:[\/\w-]+} (cap edit_theme_options)# | One registered font collection, by its slug. |
Internals 2
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | collections(): array# | The collections registered with the font library (WP_Font_Library), which keeps its one instance on the runtime; none before anything registers one. @return array<string, object> | |||
| private | item(object $collection, array $data): array# | A collection as wp/v2 shapes it, through rest_prepare_font_collection.
@return array<string, mixed> |
Nothing matches.