System\Models\PluginVersion\HasDisabledContext
Overview
HasDisabledContext adds per-site and per-site-group disabled state to the PluginVersion model, providing a unified interface for checking and toggling the disabled state based on the current site context.
Protected Properties
protected static array|null $contextDisabledCodes
contextDisabledCodes is a cached list of disabled plugin codes for the current site context. Shared across all instances per request.
Public Methods
public getContextDisabledAttribute()
public getContextDisabledAttribute(): void
getContextDisabledAttribute returns true if the plugin is disabled, considering the current site context. Falls back to global is_disabled when no context.
public static getPluginSiteContext()
public static getPluginSiteContext(): array|null
getPluginSiteContext returns the active site or site group context for per-site plugin filtering, or null if the feature is not active.
public static resetContextDisabledCache()
public static resetContextDisabledCache(): void
resetContextDisabledCache clears the cached context disabled codes so they are re-fetched on the next access.
public setContextDisabled()
public setContextDisabled(): void
setContextDisabled disables this plugin for the current site context, or globally if no site context is active.
public setContextEnabled()
public setContextEnabled(): void
setContextEnabled enables this plugin for the current site context, or globally if no site context is active.
Protected Methods
protected static listContextDisabledCodes()
protected static listContextDisabledCodes(): array|null
listContextDisabledCodes returns the list of plugin codes disabled for the current site context, or null if no site context is active.