InstalledThemesController final readonly class
Minn\Rest\InstalledThemesController · public/minn/src/Minn/Rest/InstalledThemesController.php · 141 lines
wp/v2/themes as the reference answers it (probe rest-themes): the installed themes, or only those with a status (active, inactive), each with its style.css headers raw and rendered, where it lives, and whether it is a block theme. The active theme also carries its supports as the editor reads them, the template types and part areas it may define, and a link to the theme export; any theme with user styles links to them. Anyone who can edit a type shown in REST may read the active theme; listing the others takes switch_themes. Each theme goes through rest_prepare_theme. Served with plugins loaded, since a theme's supports come from its own code.
Constants and properties
| private | STATUS = array ( 'status' => array ( 'type' => 'array', 'items' => array ( 'type' => 'string', 'enum' => array ( 0 => 'active', 1 => 'inactive', ), ), 'description' => 'Limit result set to themes assigned one or more statuses.', '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/themes (public)# | The installed themes the caller may see. |
| method | single(Minn\Http\Request $request, string $stylesheet): Minn\Http\ResponseGET /wp/v2/themes/{stylesheet:[^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?} (public)# | One theme by its stylesheet. |
| method | fields(WP_Theme $theme, WP_REST_Request $request): array# | A theme in the wp/v2 shape, its links included, before rest_prepare_theme (the runtime's WP_REST_Themes_Controller shapes through here); the request is what the supports' callbacks are handed. @return array<string, mixed> |
Internals 6
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | item(WP_Theme $theme): array# | @return array<string, mixed> |
| private | links(WP_Theme $theme): array# | @return array<string, list<array<string, mixed>>> |
| private | viewsThemes(): bool# | May list the installed themes. |
| private | viewsActive(): bool# | May read the active theme: anyone who lists themes, or edits a type shown in REST. |
| private | status(string $stylesheet): string# | |
| private | requireRuntime(): void# | A theme's supports come from its own code: without the runtime there is no answer to give. |
Nothing matches.