PluginBase
Plugin base class
class System\Classes\PluginBase
extends Illuminate\Support\ServiceProvider
Extends
Class | Description |
---|---|
Illuminate\Support\ServiceProvider
|
Properties
public
$disabled
:
bool
= false
Determine if this plugin should be loaded (false) or not (true).
public
$elevated
:
bool
= false
Determine if this plugin should have elevated privileges.
public
$require
:
array
= []
Plugin dependencies
protected $app : Winter\Storm\Foundation\Application
The application instance.
protected
$loadedYamlConfiguration
:
bool
= false
protected $path : string
The absolute path to this plugin's directory, access with getPluginPath()
protected $version : string
The version of this plugin as reported by updates/version.yaml, access with getPluginVersion()
Methods
public boot () : void
Boot method, called right before the request route.
public canReplacePlugin (string $pluginIdentifier, string $version) : bool
Check if the provided plugin & version can be replaced by this plugin
Property | Type | Description |
---|---|---|
$pluginIdentifier | string |
string
|
$version | string |
string
|
public checkDependencies (System\Classes\PluginManager $manager) : bool
Verifies the plugin's dependencies are present and enabled
Property | Type | Description |
---|---|---|
$manager | System\Classes\PluginManager |
System\Classes\PluginManager
|
public getPluginIdentifier () : string
Gets the identifier for this plugin
Identifier in format of Author.Plugin
public getPluginPath () : string
Returns the absolute path to this plugin's directory
public getPluginVersion () : string
Gets the current version of the plugin as reported by updates/version.yaml
public
getPluginVersions (boolean $includeScripts = true
)
: array
Gets the contents of the plugin's updates/version.yaml file and normalizes the results
Property | Type | Description |
---|---|---|
$includeScripts | boolean |
boolean
|
public
getReplaces (boolean $includeConstraints = false
)
: array
Gets list of plugins replaced by this plugin
Property | Type | Description |
---|---|---|
$includeConstraints | boolean |
boolean
Include version constraints in the results as the array values |
['Author.Plugin'] or ['Author.Plugin' => 'self.version']
public pluginDetails () : array
Returns information about this plugin, including plugin name and developer name.
public register () : void
Register method, called when the plugin is first registered.
public registerComponents () : array
Registers any front-end components implemented in this plugin.
public registerConsoleCommand (string $key, string | Closure $command) : void
Registers a new console (artisan) command
Property | Type | Description |
---|---|---|
$key | string |
string
The command name |
$command | string | Closure |
string | Closure
The command class or closure |
public registerFormWidgets () : array
Registers any form widgets implemented in this plugin.
The widgets must be returned in the following format:
return [ ['className1' => 'alias'], ['className2' => 'anotherAlias'] ];
public registerListColumnTypes () : array
Registers custom back-end list column types introduced by this plugin.
public registerMailLayouts () : array
Registers any mail layouts implemented by this plugin.
The layouts must be returned in the following format:
return [ 'marketing' => 'acme.blog::layouts.marketing', 'notification' => 'acme.blog::layouts.notification', ];
public registerMailPartials () : array
Registers any mail partials implemented by this plugin.
The partials must be returned in the following format:
return [ 'tracking' => 'acme.blog::partials.tracking', 'promotion' => 'acme.blog::partials.promotion', ];
public registerMailTemplates () : array
Registers any mail templates implemented by this plugin.
The templates must be returned in the following format:
return [ 'acme.blog::mail.welcome', 'acme.blog::mail.forgot_password', ];
public registerMarkupTags () : array
Registers CMS markup tags introduced by this plugin.
public registerNavigation () : array
Registers back-end navigation items for this plugin.
public registerPermissions () : array
Registers any back-end permissions used by this plugin.
public registerQuickActions () : array
Registers back-end quick actions for this plugin.
public registerReportWidgets () : array
Registers any report widgets provided by this plugin.
The widgets must be returned in the following format:
return [ 'className1'=>[ 'label' => 'My widget 1', 'context' => ['context-1', 'context-2'], ], 'className2' => [ 'label' => 'My widget 2', 'context' => 'context-1' ] ];
public registerSchedule (Schedule $schedule) : void
Registers scheduled tasks that are executed on a regular basis.
Property | Type | Description |
---|---|---|
$schedule | Schedule |
Schedule
|
public registerSettings () : array
Registers any back-end configuration links used by this plugin.
protected
getConfigurationFromYaml (string | null $exceptionMessage = null
)
: array | bool
Read configuration from YAML file
Property | Type | Description |
---|---|---|
$exceptionMessage | string | null |
string | null
|