API / Minn\Rest / StatusesController

StatusesController final readonly class

Minn\Rest\StatusesController · public/minn/src/Minn/Rest/StatusesController.php · 97 lines

wp/v2/statuses as the reference answers it (probe rest-statuses): every post status that is not internal, a plugin's beside core's, by name, and trash last. A visitor sees the public ones; someone who can edit a type shown in REST sees them all, and only they may ask for the edit context of the list. Each status links to its posts and goes through rest_prepare_status. Like wp/v2/types, the list is keyed by name, so _fields over the whole of it keeps nothing.

Used by 1

Constants and properties

privateFIELDS = array ( 'embed' => array ( 0 => 'name', 1 => 'slug', ), 'view' => array ( 0 => 'name', 1 => 'public', 2 => 'queryable', 3 => 'slug', 4 => 'date_floating', ), 'edit' => array ( 0 => 'name', 1 => 'private', 2 => 'protected', 3 => 'public', 4 => 'queryable', 5 => 'show_in_list', 6 => 'slug', 7 => 'date_floating', ), )

The fields each context shows, in the reference's order.

privatereadonly Minn\Rest\RestUrl $url

Promoted from the constructor.

privatereadonly Minn\Rest\Caller $caller

Promoted from the constructor.

Public

new__construct(Minn\Rest\RestUrl $url, Minn\Rest\Caller $caller)#
methodlist(Minn\Http\Request $request): Minn\Http\ResponseGET /wp/v2/statuses (public)#

The statuses the caller may see.

methodsingle(Minn\Http\Request $request, string $status): Minn\Http\ResponseGET /wp/v2/statuses/{status:[\w-]+} (public)#

One status.

Internals 4

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

privateitem(string $name, array $status, array $fields): array#

A status as the reference shows it, its link to its posts after its fields.

$statusarray<string, mixed>
$fieldslist<string>
@return array<string, mixed>
privatereadable(string $name, array $status): bool#

Whether the caller may see a status: a public one, or (for someone who edits a type shown in REST) any but an internal one; trash counts as not internal.

$statusarray<string, mixed>
privatestatuses(): array#

Every registered status: a plugin's too once plugins are loaded. @return array<string, array<string, mixed>>

@return array<string, array<string, mixed>>
privatecontext(Minn\Http\Request $request): string#