PluginInterface

Type
Interface
Namespace
craft\base
Implemented by
craft\base\Plugin
Since
3.0

PluginInterface defines the common interface to be implemented by plugin classes.

A class implementing this interface should also use craft\base\PluginTrait.

View source

Public Methods

MethodDescription
getCpNavItem()Returns the CP nav item definition for this plugin’s CP section, if it has one.
getHandle()Returns the plugin’s handle (really just an alias of yii\base\Module::$id).
getMigrator()Returns the plugin’s migration manager
getSettings()Returns the model that the plugin’s settings should be stored on, if the plugin has settings.
getSettingsResponse()Returns the settings page response.
getVersion()Returns the plugin’s current version.
install()Installs the plugin.
setSettings()Sets the plugin settings
uninstall()Uninstalls the plugin.

getCpNavItem()

Returns the CP nav item definition for this plugin’s CP section, if it has one.

See also:

View source

Returns

array, null

Signature

public abstract array, null getCpNavItem ( )

getHandle()

Returns the plugin’s handle (really just an alias of yii\base\Module::$id).

View source

Returns

string – The plugin’s handle

Signature

public abstract string getHandle ( )

getMigrator()

Returns the plugin’s migration manager

View source

Returns

craft\db\MigrationManager – The plugin’s migration manager

Signature

public abstract craft\db\MigrationManager getMigrator ( )

getSettings()

Returns the model that the plugin’s settings should be stored on, if the plugin has settings.

View source

Returns

craft\base\Model, null – The model that the plugin’s settings should be stored on, if the plugin has settings

Signature

public abstract craft\base\Model, null getSettings ( )

getSettingsResponse()

Returns the settings page response.

View source

Returns

mixed – The result that should be returned from craft\controllers\PluginsController::actionEditPluginSettings()

Signature

public abstract mixed getSettingsResponse ( )

getVersion()

Returns the plugin’s current version.

View source

Returns

string – The plugin’s current version

Signature

public abstract string getVersion ( )

install()

Installs the plugin.

View source

Returns

void, false – Return false to indicate the installation failed. All other return values mean the installation was successful.

Signature

public abstract void, false install ( )

setSettings()

Sets the plugin settings

View source

Arguments

  • $settings (array) – The plugin settings that should be set on the settings model

Signature

public abstract void setSettings ( array $settings )

uninstall()

Uninstalls the plugin.

View source

Returns

void, false – Return false to indicate the uninstallation failed. All other return values mean the uninstallation was successful.

Signature

public abstract void, false uninstall ( )