API / Minn\Rest / TermObject

TermObject final readonly class

Minn\Rest\TermObject · public/minn/src/Minn/Rest/TermObject.php · 107 lines

The wp/v2 category and tag objects.

Constants and properties

privateTAXONOMIES = array ( 'categories' => array ( 'taxonomy' => 'category', 'has_parent' => true, 'post_arg' => 'categories', 'post_base' => 'posts', ), 'tags' => array ( 'taxonomy' => 'post_tag', 'has_parent' => false, 'post_arg' => 'tags', 'post_base' => 'posts', ), 'wp_pattern_category' => array ( 'taxonomy' => 'wp_pattern_category', 'has_parent' => false, 'post_arg' => 'wp_pattern_category', 'post_base' => 'blocks', ), )
privatereadonly Minn\Db $db

Promoted from the constructor.

privatereadonly Minn\Front\Permalinks $permalinks

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\Db $db, Minn\Front\Permalinks $permalinks, Minn\Rest\RestUrl $url, Minn\Rest\Caller $caller)#
methodview(Minn\Content\TermRecord $term, string $restBase): array#

A term as its REST base shows it, through rest_prepare_{taxonomy} when a plugin hooks it.

methodurl(): Minn\Rest\RestUrl#

The REST URL builder.

staticconfig(string $restBase): array#

The taxonomy behind a rest_base.

@return array{taxonomy: string, has_parent: bool, post_arg: string, post_base: string}
staticregistered(string $restBase): ?array#

A taxonomy plugin code registered to show in REST under wp/v2, by its REST base (probe rest-plugin-types), as a term route's config: its terms nest when it is hierarchical, and its posts are those of the first type it belongs to.

@return array{taxonomy: string, has_parent: bool, post_arg: string, post_base: string}|null

Internals 2

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

privateviewFields(Minn\Content\TermRecord $term, string $restBase): array#

The wp/v2 term shape.

privateallowedVerbs(Minn\Content\TermRecord $term, array $config): array#

Managers may write; nobody may delete the default category.