API / Minn\Rest / TemplateObject

TemplateObject final readonly class

Minn\Rest\TemplateObject · public/minn/src/Minn/Rest/TemplateObject.php · 101 lines

The wp/v2/templates and wp/v2/template-parts resource.

Constants and properties

privatereadonly Minn\Theme\TemplateIndex $index

Promoted from the constructor.

privatereadonly Minn\Content\Posts $posts

Promoted from the constructor.

privatereadonly Minn\Rest\RestUrl $url

Promoted from the constructor.

privatereadonly Minn\Rest\Caller $caller

Promoted from the constructor.

Public

new__construct(Minn\Theme\TemplateIndex $index, Minn\Content\Posts $posts, Minn\Rest\RestUrl $url, Minn\Rest\Caller $caller)#
methodbase(string $type): string#

The rest_base of a template type.

methodview(Minn\Theme\TemplateRecord $record, Minn\Rest\Context $context, ?string $as = NULL): array#

The wp/v2 template shape.

Internals 1

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

privatelinks(Minn\Theme\TemplateRecord $record, string $as): array#

The write links and their curies show only to a caller who could use them; a reader who may list templates but not change them sees a self link that allows GET and nothing else.