BlockTypesController final readonly class
Minn\Rest\BlockTypesController · public/minn/src/Minn/Rest/BlockTypesController.php · 133 lines
wp/v2/block-types as the reference answers it (probe rest-block-types): every registered block type, core's and a plugin's, in registration order, or a namespace's share, for anyone who can edit a type shown in REST. Each carries its registration (attributes, supports, selectors, contexts, asset handles and the first of each as the old single field) with its styles (its own, then those registered for it) and its variations as built when asked; a dynamic block links to its renderer. Served with plugins loaded, since a plugin's blocks come from its code.
Constants and properties
| private | NAMESPACE = array ( 'namespace' => array ( 'type' => 'string', 'description' => 'Block namespace.', 'required' => false, ), ) | |
| private | readonly Minn\Rest\RestUrl $url | Promoted from the constructor. |
| private | readonly Minn\Rest\Caller $caller | Promoted from the constructor. |
Public
| new | __construct(Minn\Rest\RestUrl $url, Minn\Rest\Caller $caller)# | |
| method | list(Minn\Http\Request $request): Minn\Http\ResponseGET /wp/v2/block-types (public)# | Every block type, or those of one namespace (?namespace=). |
| method | inNamespace(Minn\Http\Request $request, string $namespace): Minn\Http\ResponseGET /wp/v2/block-types/{namespace:[a-zA-Z0-9_-]+} (public)# | One namespace's block types. |
| method | single(Minn\Http\Request $request, string $namespace, string $name): Minn\Http\ResponseGET /wp/v2/block-types/{namespace:[a-zA-Z0-9_-]+}/{name:[a-zA-Z0-9_-]+} (public)# | One block type. |
| static | fields(Minn\Objects\BlockType $type): array# | A block type's fields in the reference's order, as the route and WP_REST_Block_Types_Controller show them: its registration (supports {} when it has none), its styles (its own, then those registered for it), its variations as built when asked, and the first handle of each asset kind as the old single field (probe rest-block-controllers). @return array<string, mixed> |
Internals 4
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | items(Minn\Http\Request $request, string $namespace): Minn\Http\Response# | |
| private | item(Minn\Objects\BlockType $type): array# | @return array<string, mixed> |
| private | links(Minn\Objects\BlockType $type): array# | @return array<string, list<array<string, mixed>>> |
| private | requireViewer(): void# | Only someone who edits a type shown in REST may read block types; the runtime holds them. |
Nothing matches.