API / Minn\Rest / Types

Types final class

Minn\Rest\Types · public/minn/src/Minn/Rest/Types.php · 190 lines

The engine's registry of built-in post types, seeded from the observed contract (src/data/types.json) with _links attached at runtime.

Constants and properties

private?array $types
privatereadonly Minn\Rest\RestUrl $url

Promoted from the constructor.

privatereadonly array $declared

Promoted from the constructor.

Public

new__construct(Minn\Rest\RestUrl $url, array $declared = array ( ))#
$declaredarray<string, array<string, mixed>>extra types from active extensions
methodall(): array#

Every post type the surface knows, by slug.

@return array<string, array> keyed by type slug
methodfind(string $slug): ?array#

One post type by slug, or null.

methodslugForRestBase(string $base): ?string#

The type behind a rest_base, or null.

methoddeclaredBases(): array#

The rest_base of every type an extension declared or plugin code registered under wp/v2. @return list<string>

@return list<string>
methodrouteBases(): array#

Every base the {base} routes serve: the declared post types' and the taxonomies plugin code registered to show in REST under wp/v2.

@return list<string>
methodisDeclared(string $slug): bool#

Whether the engine serves this type through its {base} routes: an extension declared it, or plugin code registered it to show in REST under wp/v2 (probe rest-plugin-types).

methodsearchable(): array#

The types a post search covers: the built-in post and page, the ones extensions declare, and the public types plugin code shows in REST, as the reference's post search handler takes them.

@return list<string>
methodrestBase(string $slug): string#

The rest_base of a type slug.

Internals 3

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

privatecore(): array#

The built-in types and the ones extensions declare. @return array<string, array>

@return array<string, array>
privateregistered(): array#

The types plugin code registered to show in REST (probe rest-types-edit), in registration order, as the reference describes them: their label, icon, the taxonomies they show in REST.

@return array<string, array>
privateservedRegistered(): array#
@return array<string, array> the registered types under wp/v2