PluginTrait

Type
Trait
Namespace
craft\base
Implemented by
craft\base\Plugin
Since
3.0.0

PluginTrait implements the common methods and properties for plugin classes.

View source (opens new window)

# Public Properties

Property Description
changelogUrl string (opens new window), null (opens new window) – The plugin’s changelog URL.
description string (opens new window), null (opens new window) – The plugin’s description
developer string (opens new window), null (opens new window) – The plugin developer’s name
developerEmail string (opens new window), null (opens new window) – The plugin developer’s support email
developerUrl string (opens new window), null (opens new window) – The plugin developer’s website URL
documentationUrl string (opens new window), null (opens new window) – The plugin’s documentation URL
downloadUrl string (opens new window), null (opens new window) – The plugin’s download URL
edition string (opens new window) – The active edition.
hasCpSection boolean (opens new window) – Whether the plugin has its own section in the control panel
hasCpSettings boolean (opens new window) – Whether the plugin has a settings page in the control panel
isInstalled boolean (opens new window) – Whether the plugin is currently installed.
minVersionRequired string (opens new window) – The minimum required version the plugin has to be so it can be updated.
name string (opens new window), null (opens new window) – The plugin’s display name
packageName string (opens new window), null (opens new window) – The plugin’s package name
schemaVersion string (opens new window) – The plugin’s schema version number
sourceLanguage string (opens new window) – The language that the plugin’s messages were written in
t9nCategory string (opens new window), null (opens new window) – The translation category that this plugin’s translation messages should use.

# changelogUrl

Type
string (opens new window), null (opens new window)
Default value
null

The plugin’s changelog URL.

The URL should begin with https:// and point to a plain text Markdown-formatted changelog. Version headers must follow the general format:

## X.Y.Z - YYYY-MM-DD

with the following possible deviations:

  • other text can come before the version number, like the plugin’s name
  • a 4th version number is allowed (e.g. 1.2.3.4)
  • pre-release versions are allowed (e.g. 1.0.0-alpha.1)
  • the version can start with v (e.g. v1.2.3)
  • the version can be hyperlinked (e.g. [1.2.3])
  • dates can use dots as separators, rather than hyphens (e.g. YYYY.MM.DD)
  • a [CRITICAL] flag can be appended after the date to indicate a critical release

More notes:

  • Releases should be listed in descending order (newest on top). Craft will stop parsing the changelog as soon as it hits a version that is older than or equal to the installed version.
  • Any content that does not follow a version header line will be ignored.
  • For consistency and clarity, release notes should follow keepachangelog.com (opens new window), but it’s not enforced.
  • Release notes can contain notes using the format > {note} Some note. {warning} and {tip} are also supported.

View source (opens new window)

# description

Type
string (opens new window), null (opens new window)
Default value
null

The plugin’s description

View source (opens new window)

# developer

Type
string (opens new window), null (opens new window)
Default value
null

The plugin developer’s name

View source (opens new window)

# developerEmail

Type
string (opens new window), null (opens new window)
Default value
null

The plugin developer’s support email

View source (opens new window)

# developerUrl

Type
string (opens new window), null (opens new window)
Default value
null

The plugin developer’s website URL

View source (opens new window)

# documentationUrl

Type
string (opens new window), null (opens new window)
Default value
null

The plugin’s documentation URL

View source (opens new window)

# downloadUrl

Type
string (opens new window), null (opens new window)
Default value
null

The plugin’s download URL

View source (opens new window)

# edition

Type
string (opens new window)
Default value
'standard'

The active edition.

View source (opens new window)

# hasCpSection

Type
boolean (opens new window)
Default value
false

Whether the plugin has its own section in the control panel

View source (opens new window)

# hasCpSettings

Type
boolean (opens new window)
Default value
false

Whether the plugin has a settings page in the control panel

View source (opens new window)

# isInstalled

Type
boolean (opens new window)
Default value
false

Whether the plugin is currently installed. (Will only be false when a plugin is currently being installed.)

View source (opens new window)

# minVersionRequired

Type
string (opens new window)
Default value
''

The minimum required version the plugin has to be so it can be updated.

View source (opens new window)

# name

Type
string (opens new window), null (opens new window)
Default value
null

The plugin’s display name

View source (opens new window)

# packageName

Type
string (opens new window), null (opens new window)
Default value
null

The plugin’s package name

View source (opens new window)

# schemaVersion

Type
string (opens new window)
Default value
'1.0.0'

The plugin’s schema version number

View source (opens new window)

# sourceLanguage

Type
string (opens new window)
Default value
'en-US'

The language that the plugin’s messages were written in

View source (opens new window)

# t9nCategory

Type
string (opens new window), null (opens new window)
Default value
null

The translation category that this plugin’s translation messages should use. Defaults to the lowercased plugin handle.

View source (opens new window)