API / Minn\Rest / PostCollectionParams

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

privateFORMATS = array ( 0 => 'standard', 1 => 'aside', 2 => 'chat', 3 => 'gallery', 4 => 'link', 5 => 'image', 6 => 'quote', 7 => 'status', 8 => 'video', 9 => 'audio', )
privateSTATUSES = 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', )
privateIDS = array ( 'type' => 'array', 'items' => array ( 'type' => 'integer', ), 'default' => array ( ), )

Public

staticfor(array $captures): array#

The parameters of the list a {base} capture names; none for a base no REST post type has.

staticofType(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>>
staticlisted(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>>
staticbuilt(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>>
staticmediaTypes(): 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.

privatenamed(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
privateforType(?array $type): array#
$typearray{name: string, object: ?\WP_Post_Type, author: bool, attributes: bool, hierarchical: bool, formats: bool, taxonomies: array<string, bool>}|null@return array<string, array<string, mixed>>
privatefiltered(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>>

$typearray{name: string, object: ?\WP_Post_Type, author: bool, attributes: bool, hierarchical: bool, formats: bool, taxonomies: array<string, bool>}@return array<string, array<string, mixed>>
privatetype(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
privatedescribed(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>}
privatebuild(array $type): array#
$typearray{name: string, author: bool, attributes: bool, hierarchical: bool, formats: bool, taxonomies: array<string, bool>}@return array<string, array<string, mixed>>
privatestatuses(): array#
@return list<string>
privatetaxonomies(array $taxonomies): array#

The term filters: a relation, then each taxonomy's include and exclude.

$taxonomiesarray<string, bool>REST base => hierarchical
@return array<string, array<string, mixed>>
privatetermFilter(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>

$propertiesarray<string, array<string, mixed>>@return array<string, mixed>