FontObject final readonly class
Minn\Rest\FontObject · public/minn/src/Minn/Rest/FontObject.php · 93 lines
A font family and a font face as wp/v2 shapes them (probe: the font library routes on the reference): the id, the theme.json version (3, which nothing stores), and the settings the post holds: a family's name and slug from its title and slug, then its font family and preview from its JSON content; a face's font-face properties from its JSON content. A family lists its faces by id, oldest first, each a link that embeds; a face links to its family. The same fields show in every context, and the fields plugin code registers join through rest_prepare_wp_font_family and rest_prepare_wp_font_face. Only someone who may edit theme options sees either, and may use every method on it.
Constants and properties
| private | FAMILY_METHODS = array ( 0 => 'GET', 1 => 'POST', 2 => 'PUT', 3 => 'PATCH', 4 => 'DELETE', ) | |
| private | FACE_METHODS = array ( 0 => 'GET', 1 => 'DELETE', ) | |
| private | FACE_PROPERTIES = array ( 0 => 'fontFamily', 1 => 'fontStyle', 2 => 'fontWeight', 3 => 'fontDisplay', 4 => 'src', 5 => 'fontStretch', 6 => 'ascentOverride', 7 => 'descentOverride', 8 => 'fontVariant', 9 => 'fontFeatureSettings', 10 => 'fontVariationSettings', 11 => 'lineGapOverride', 12 => 'sizeAdjust', 13 => 'unicodeRange', 14 => 'preview', ) | |
| private | readonly Minn\Rest\RestUrl $url | Promoted from the constructor. |
Public
| new | __construct(Minn\Rest\RestUrl $url)# | |
| method | family(Minn\Content\PostRecord $post): array# | A font family as wp/v2 shapes it, through rest_prepare_wp_font_family. @return array<string, mixed> @return array<string, mixed> |
| method | face(Minn\Content\PostRecord $post): array# | A font face as wp/v2 shapes it, through rest_prepare_wp_font_face. @return array<string, mixed> @return array<string, mixed> |
Internals 3
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | faceIds(int $familyId): array# | A family's faces, oldest first, as the reference's query lists them (the first 99 by date alone, so faces of one second come as the database gives them). @return list<int> |
| private | familySettings(Minn\Content\PostRecord $post): array# | A family's settings: its name and slug from the post, then its font family and preview from the JSON its content holds, each empty when missing; nothing else the content holds shows. @return array<string, mixed> |
| private | faceSettings(string $content): array# | A face's settings: the font-face properties its content's JSON holds, in its order, anything else left out; content that is no JSON at all shows an empty font family and no sources. @return array<string, mixed> |
Nothing matches.