TermsController final readonly class
Minn\Rest\TermsController · public/minn/src/Minn/Rest/TermsController.php · 193 lines
wp/v2 categories, tags, and pattern categories: list, single, and the create/update/delete the taxonomy admin drives.
Uses 26 (show)
Constants and properties
| private | readonly Minn\Db $db | Promoted from the constructor. |
| private | readonly Minn\Content\Terms $terms | Promoted from the constructor. |
| private | readonly Minn\Content\Site $site | Promoted from the constructor. |
| private | readonly Minn\Rest\TermObject $object | Promoted from the constructor. |
| private | readonly Minn\Rest\Caller $caller | Promoted from the constructor. |
Public
| new | __construct(Minn\Db $db, Minn\Content\Terms $terms, Minn\Content\Site $site, Minn\Rest\TermObject $object, Minn\Rest\Caller $caller)# | |
| method | list(Minn\Http\Request $request, string $base): Minn\Http\ResponseGET /wp/v2/{base:categories|tags|wp_pattern_category} (public)# | A taxonomy's term list as the reference serves it: the request's get_terms (wp_get_object_terms for a post's) through rest_{taxonomy}_collection_params and rest_{taxonomy}_query, counted by wp_count_terms without the page. |
| method | single(Minn\Http\Request $request, string $base, string $id): Minn\Http\ResponseGET /wp/v2/{base:categories|tags|wp_pattern_category}/{id:[\d]+} (public; term {id} must exist; edit context: cap manage_categories)# | One category or tag. |
| method | create(Minn\Http\Request $request, string $base): Minn\Http\ResponsePOST /wp/v2/{base:categories} (cap manage_categories)POST /wp/v2/{base:tags|wp_pattern_category} (cap edit_posts)# | Tags and pattern categories are open to edit_posts holders; categories need manage_categories. |
| method | update(Minn\Http\Request $request, string $base, string $id): Minn\Http\ResponsePOST /wp/v2/{base:categories|tags|wp_pattern_category}/{id:[\d]+} (cap manage_categories; term {id} must exist)PUT /wp/v2/{base:categories|tags|wp_pattern_category}/{id:[\d]+} (cap manage_categories; term {id} must exist)PATCH /wp/v2/{base:categories|tags|wp_pattern_category}/{id:[\d]+} (cap manage_categories; term {id} must exist)# | Updates a category or tag. |
| method | delete(Minn\Http\Request $request, string $base, string $id): Minn\Http\ResponseDELETE /wp/v2/{base:categories|tags|wp_pattern_category}/{id:[\d]+} (cap manage_categories; term {id} must exist)# | The default category is capability-denied before the force check. |
| static | createCapability(string $taxonomy): string# | What creating a term needs (probe rest-plugin-caps): a plugin's taxonomy, its edit_terms when hierarchical and its assign_terms when flat; categories, manage_categories; the others, edit_posts. |
Internals 2
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | requireParent(int $parent, string $taxonomy): void# | The reference's refusal of a parent that is not there, before anything is saved. | |||
| private | termsReadable(WP_Post $post, array $objectTypes): bool# | Whether a post's terms may be listed: the taxonomy must be one of its type's, and the post publicly viewable (a public status of a viewable type, a password or not) or one the caller may read, as the reference judges it.
|
Nothing matches.