PostCollectionParams final class
Minn\Rest\PostCollectionParams · public/minn/src/Minn/Rest/PostCollectionParams.php · 242 lines · implements Minn\Http\RouteParams
A post type's collection parameters as the reference builds them for its list (probe rest-post-lists): the shared four, dates, authors when the type supports them, ids, menu order and its orderby for page attributes, parents for a hierarchical type, search columns and semantics, slugs, statuses (every registered one, and any), each REST taxonomy's term filter (a list, or a query with children for a hierarchical one and an operator for the include side) under a relation, stickies for posts, and formats for a type with post formats. Plugins change them through rest_{type}_collection_params, asked once a request.
Constants and properties
| private | FORMATS = array ( 0 => 'standard', 1 => 'aside', 2 => 'chat', 3 => 'gallery', 4 => 'link', 5 => 'image', 6 => 'quote', 7 => 'status', 8 => 'video', 9 => 'audio', ) | |
| private | STATUSES = array ( 0 => 'publish', 1 => 'future', 2 => 'draft', 3 => 'pending', 4 => 'private', 5 => 'trash', 6 => 'auto-draft', 7 => 'inherit', 8 => 'request-pending', 9 => 'request-confirmed', 10 => 'request-failed', 11 => 'request-completed', ) | |
| private | IDS = array ( 'type' => 'array', 'items' => array ( 'type' => 'integer', ), 'default' => array ( ), ) |
Public
| static | for(array $captures): array# | The parameters of the list a {base} capture names; none for a base no REST post type has. |
| static | ofType(string $name): array# | The parameters of a post type's list, by the type's name. @return array<string, array<string, mixed>> @return array<string, array<string, mixed>> |
| static | listed(string $name): array# | A post type's list parameters asked afresh, as the reference's list asks for them each time it runs: rest_{type}_collection_params runs again. @return array<string, array<string, mixed>> |
| static | built(WP_Post_Type $object): array# | A post type's list parameters as built, for the type in any namespace: before rest_{type}_collection_params and the optional marks, for the facade's controller class, which adds its callbacks and runs the filter itself. @return array<string, array<string, mixed>> |
| static | mediaTypes(): array# | The allowed MIME types by media type (the part before the slash), in the order the site allows them, each once. @return array<string, list<string>> |
Internals 9
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | named(string $name): ?array# | A REST post type by its name, in whatever namespace it lists itself (a plugin's type under a namespace of its own has the same list as one under wp/v2); posts and pages by name before plugins load. @return array{name: string, object: ?\WP_Post_Type, author: bool, attributes: bool, hierarchical: bool, formats: bool, taxonomies: array<string, bool>}|null | |||
| private | forType(?array $type): array# |
| |||
| private | filtered(array $type): array# | The parameters built, through rest_{type}_collection_params, each marked optional. @param array{name: string, object: ?\WP_Post_Type, author: bool, attributes: bool, hierarchical: bool, formats: bool, taxonomies: array<string, bool>} $type @return array<string, array<string, mixed>>
| |||
| private | type(string $base): ?array# | The type a REST base names, with what its parameters depend on. Posts and pages are known before plugins load; other types once they have. @return array{name: string, object: ?\WP_Post_Type, author: bool, attributes: bool, hierarchical: bool, formats: bool, taxonomies: array<string, bool>}|null | |||
| private | described(string $name, WP_Post_Type $object): array# | @return array{name: string, object: ?\WP_Post_Type, author: bool, attributes: bool, hierarchical: bool, formats: bool, taxonomies: array<string, bool>} | |||
| private | build(array $type): array# |
| |||
| private | statuses(): array# | @return list<string> | |||
| private | taxonomies(array $taxonomies): array# | The term filters: a relation, then each taxonomy's include and exclude.
@return array<string, array<string, mixed>> | |||
| private | termFilter(string $description, array $properties): array# | One term filter: an id list, or a query object with these properties beside its terms. @param array<string, array<string, mixed>> $properties @return array<string, mixed>
|
Nothing matches.