Craft 3 Class Reference

Interface craft\base\PluginInterface

Implemented by
craft\base\Plugin
Available since version
3.0
Source Code
https://github.com/craftcms/cms/blob/master/src/base/PluginInterface.php

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

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

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

Method Details

getCpNavItem() public abstract method #

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

See also:

public abstract array, null getCpNavItem ( )

getHandle() public abstract method #

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

public abstract string getHandle ( )
return string The plugin’s handle

getMigrator() public abstract method #

Returns the plugin’s migration manager

public abstract craft\db\MigrationManager getMigrator ( )
return craft\db\MigrationManager The plugin’s migration manager

getSettings() public abstract method #

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

public abstract craft\base\Model, null getSettings ( )
return craft\base\Model, null The model that the plugin’s settings should be stored on, if the plugin has settings

getSettingsResponse() public abstract method #

Returns the settings page response.

public abstract mixed getSettingsResponse ( )
return mixed The result that should be returned from craft\controllers\PluginsController::actionEditPluginSettings()

getVersion() public abstract method #

Returns the plugin’s current version.

public abstract string getVersion ( )
return string The plugin’s current version

install() public abstract method #

Installs the plugin.

public abstract void, false install ( )
return void, false Return false to indicate the installation failed. All other return values mean the installation was successful.

setSettings() public abstract method #

Sets the plugin settings

public abstract void setSettings ( array $settings )
$settings array The plugin settings that should be set on the settings model

uninstall() public abstract method #

Uninstalls the plugin.

public abstract void, false uninstall ( )
return void, false Return false to indicate the uninstallation failed. All other return values mean the uninstallation was successful.