TermEvents final readonly class
Minn\Runtime\TermEvents · public/minn/src/Minn/Runtime/TermEvents.php · 114 lines
What the reference's REST terms controller tells plugins, for the engine's own: with plugins loaded a term is saved as that controller saves one (rest_pre_insert_{taxonomy}, then the runtime's wp_insert_term or wp_update_term, and wp_delete_term), and the REST actions follow. Without a booted runtime each write is the engine's own.
Public
| method | live(): bool# | Whether plugins are loaded to be told anything. | ||||||
| method | restCreate(string $taxonomy, array $body, Minn\Http\Request $request): int# | A term created over REST with plugins loaded, as the reference's controller creates one (probe rest-term-save): the request's fields as the prepared term, through rest_pre_insert_{taxonomy}, into wp_insert_term; a refusal is its REST error.
| ||||||
| method | restUpdate(int $termId, string $taxonomy, array $body, Minn\Http\Request $request): void# | A term changed over REST with plugins loaded: the fields the request sends, through rest_pre_insert_{taxonomy}, into wp_update_term (when any are left); a refusal is its REST error.
| ||||||
| method | delete(int $termId, string $taxonomy, array $data, Minn\Http\Request $request, Closure $quietly): void# | Deletes a term, then tells plugins over REST with the term as it was and the response.
| ||||||
| method | restSaved(int $termId, string $taxonomy, Minn\Http\Request $request, string $verb): void# | rest_insert_{taxonomy}, then rest_after_insert_{taxonomy}, with the term as it stands and the request. |
Internals 2
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | prepared(string $taxonomy, array $body, Minn\Http\Request $request): array# | The prepared term: the fields the request sends, in the reference's order, the name and slug cleaned as its schema cleans them; then rest_pre_insert_{taxonomy}.
@return array<string, mixed> | |||
| private | refusal(WP_Error $error): Minn\RestError# | A save's refusal as REST serves it: a name in use with the term's id, anything else with its own status or 500. |
Nothing matches.