Skip to content
Corex

AddonManager

Corex\Config\Addons\AddonManager · class · Config layer

The dependency-aware decisions behind the add-on screen — pure, so the safety property (you can’t break a dependency) is unit-testable with no WordPress. Disabling an add-on an active add-on requires is refused; enabling one whose required dependency is inactive is refused. The manager reasons only over the AddonState it is given.

__construct(AddonRegistry $registry, PluginActivationInspector $pluginActivationInspector)

Section titled “__construct(AddonRegistry $registry, PluginActivationInspector $pluginActivationInspector)”

blockingDependents(string $slug, AddonState $state): array

Section titled “blockingDependents(string $slug, AddonState $state): array”

Active add-ons that require $slug (so $slug cannot be disabled while they are on).

canDisable(string $slug, AddonState $state): bool

Section titled “canDisable(string $slug, AddonState $state): bool”

missingDependencies(string $slug, AddonState $state): array

Section titled “missingDependencies(string $slug, AddonState $state): array”

Required dependencies of $slug that are not active (so $slug cannot be enabled yet).

canEnable(string $slug, AddonState $state): bool

Section titled “canEnable(string $slug, AddonState $state): bool”

The live add-on state, derived from the registry and WordPress’s own active-plugin list. Lives here rather than on the Add-ons screen because it is a fact about the site, not about that screen — the capability summary needs the same answer, and two derivations of “which add-ons are running” would be two chances to disagree.

Whether an add-on’s plugin file is present on disk.

views(AddonState $state, callable $installed): array

Section titled “views(AddonState $state, callable $installed): array”