API / Minn\Rest / RegisteredPostFields

RegisteredPostFields final readonly class

Minn\Rest\RegisteredPostFields · public/minn/src/Minn/Rest/RegisteredPostFields.php · 89 lines

The REST object of a post whose type plugin code registered (probe rest-plugin-types), built by what the type supports.

Used by 1

Constants and properties

privatereadonly Minn\Content\Posts $posts

Promoted from the constructor.

privatereadonly Minn\Front\Permalinks $permalinks

Promoted from the constructor.

privatereadonly Minn\Rest\RestUrl $url

Promoted from the constructor.

Public

new__construct(Minn\Content\Posts $posts, Minn\Front\Permalinks $permalinks, Minn\Rest\RestUrl $url)#
methodview(Minn\Content\PostRecord $p, Minn\Rest\RegisteredType $type, Closure $allow, Closure $gmt): array#

A plugin's type in the view context (probe rest-plugin-types): the shared fields, then only what the type supports (title, editor, excerpt, author, thumbnail, page attributes, comments, formats, custom fields), its parent when hierarchical, each REST taxonomy's term ids under its REST base, the class list and links.

$allowClosure(int): list<string>the methods the caller may use on a post
$gmtClosure(string, string): stringa GMT date as the object writes it
@return array<string, mixed>

Internals 1

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatelinks(Minn\Content\PostRecord $p, Minn\Rest\RegisteredType $type, int $featured, array $taxonomies, Closure $allow): array#
$taxonomieslist<string>@param Closure(int): list<string> $allow @return array<string, mixed>