API / Minn\Content / PluginState

PluginState final readonly class

Minn\Content\PluginState · public/minn/src/Minn/Content/PluginState.php · 72 lines

Switching plugins on and off: a WordPress plugin file goes through the reference's activation and deactivation (PluginActivation: requirements, the plugin loaded, its hooks, the sorted active_plugins list); a Minn extension joins or leaves minn_active_extensions, and deactivating one also releases, silently, the plugin files it stood in for. The REST toggle and the CLI verbs share this so they cannot drift; both run with the runtime booted.

Constants and properties

privatereadonly Minn\Content\Site $site

Promoted from the constructor.

privatereadonly Minn\Content\Inventory $inventory

Promoted from the constructor.

privatereadonly Minn\Extension\Loader $extensions

Promoted from the constructor.

Public

new__construct(Minn\Content\Site $site, Minn\Content\Inventory $inventory, Minn\Extension\Loader $extensions)#
methodfind(string $slug): Minn\Extension\Manifest|string|null#

The relative "dir/file.php" of a WordPress plugin, else the extension for a slug, else null. A folder carrying both records in active_plugins like the reference does (the loader counts its own folder there as active); only a pure extension uses the engine's list.

methodisActive(Minn\Extension\Manifest|string $plugin): bool#

Whether a plugin, by file, or a Minn extension is active.

methodactivate(Minn\Extension\Manifest|string $plugin): ?Minn\Runtime\Refusal#

Records a plugin or an extension as active, in the option each kind uses; null, or why a plugin was refused (unexpected_output leaves it active, as the reference does).

methoddeactivate(Minn\Extension\Manifest|string $plugin): void#

Records a plugin, by file, or a Minn extension as inactive; an extension also deactivates the plugins it replaced.

Internals 1

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

privateownWithout(Minn\Extension\Manifest $plugin): array#

The active extensions minus one. @return list<string>

@return list<string>