PluginsController final readonly class
Minn\Rest\PluginsController · public/minn/src/Minn/Rest/PluginsController.php · 243 lines
wp/v2 plugins: what sits in wp-content/plugins, in the reference's shape. Minn extensions (a minn.json manifest) are listed alongside the WordPress plugins the folder still holds; the engine runs the former and only records the latter's stored state. Activation writes the same options the reference and the extension loader read; files are never installed or deleted from here.
Constants and properties
| private | readonly Minn\Content\Site $site | Promoted from the constructor. |
| private | readonly Minn\Content\Inventory $inventory | Promoted from the constructor. |
| private | readonly Minn\Extension\Loader $extensions | Promoted from the constructor. |
| private | readonly Minn\Rest\RestUrl $url | Promoted from the constructor. |
| private | readonly Minn\Rest\Caller $caller | Promoted from the constructor. |
| private | readonly Minn\Ops\Packages $packages | Promoted from the constructor. |
Public
| new | __construct(Minn\Content\Site $site, Minn\Content\Inventory $inventory, Minn\Extension\Loader $extensions, Minn\Rest\RestUrl $url, Minn\Rest\Caller $caller, Minn\Ops\Packages $packages)# | ||||
| method | list(Minn\Http\Request $request): Minn\Http\ResponseGET /wp/v2/plugins (cap activate_plugins)# | The plugins list, optionally by status. | |||
| method | install(Minn\Http\Request $request): Minn\Http\ResponsePOST /wp/v2/plugins (cap activate_plugins)# | Installs a directory plugin by slug, optionally activating it; answers 201 with the item. | |||
| method | single(Minn\Http\Request $request, string $plugin): Minn\Http\ResponseGET /wp/v2/plugins/{plugin:[^.\/]+(?:\/[^.\/]+)?} (cap activate_plugins)# | One plugin. | |||
| method | update(Minn\Http\Request $request, string $plugin): Minn\Http\ResponsePUT /wp/v2/plugins/{plugin:[^.\/]+(?:\/[^.\/]+)?} (cap activate_plugins)POST /wp/v2/plugins/{plugin:[^.\/]+(?:\/[^.\/]+)?} (cap activate_plugins)PATCH /wp/v2/plugins/{plugin:[^.\/]+(?:\/[^.\/]+)?} (cap activate_plugins)# | Activates or deactivates a plugin. | |||
| method | delete(Minn\Http\Request $request, string $plugin): Minn\Http\ResponseDELETE /wp/v2/plugins/{plugin:[^.\/]+(?:\/[^.\/]+)?} (cap activate_plugins)# | Deletes an inactive plugin. | |||
| static | shape(string $relative, string $path, array $headers, string $status): array# | A WordPress plugin's item from its headers, as the reference's controller shapes one (the runtime's WP_REST_Plugins_Controller shapes through here too): the headers translated and cut to the allowed markup once for the fields and once more, marked up, for the rendered description.
@return array<string, mixed> |
Internals 9
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | items(): array# | @return list<array> |
| private | find(string $plugin): array# | One plugin's item, built alone: an item reads (and loads the text domain of) only its own plugin. |
| private | statusOf(string $plugin): string# | Whether a plugin is active, read without building its item (nothing translated, no text domain loaded). |
| private | manifestFor(string $plugin): ?Minn\Extension\Manifest# | |
| private | extensionItem(Minn\Extension\Manifest $manifest, bool $active): array# | |
| private | pluginItem(string $relative, string $path, bool $active): array# | A WordPress plugin as the reference's item shows it: its headers read, translated and cut to the allowed markup once for the fields and once more, marked up, for the rendered description (probe plugin-data). |
| private | links(string $key): array# | |
| private | extensionKey(Minn\Extension\Manifest $manifest): string# | |
| private | refuse(?Minn\Runtime\Refusal $refusal): void# | An activation the plugin refused, as the reference's REST answer carries it: HTTP 500, the refusal's own data kept beside. |
Nothing matches.