ElementActionInterface

Type
Interface
Namespace
craft\base
Extends
craft\base\ConfigurableComponentInterface
Implemented by
craft\base\ElementAction, craft\elements\actions\CopyReferenceTag, craft\elements\actions\CopyUrl, craft\elements\actions\DeepDuplicate, craft\elements\actions\Delete, craft\elements\actions\DeleteAssets, craft\elements\actions\DeleteUsers, craft\elements\actions\DownloadAssetFile, craft\elements\actions\Duplicate, craft\elements\actions\Edit, craft\elements\actions\EditImage, craft\elements\actions\NewChild, craft\elements\actions\PreviewAsset, craft\elements\actions\RenameFile, craft\elements\actions\ReplaceFile, craft\elements\actions\Restore, craft\elements\actions\SetStatus, craft\elements\actions\SuspendUsers, craft\elements\actions\UnsuspendUsers, craft\elements\actions\View
Since
3.0.0

ElementActionInterface defines the common interface to be implemented by element action classes.

View source (opens new window)

# Public Methods

Method Description
displayName() Returns the display name of this class.
getConfirmationMessage() Returns a confirmation message that should be displayed before the action is performed.
getMessage() Returns the message that should be displayed to the user after the action is performed.
getSettings() Returns an array of the component’s settings.
getSettingsHtml() Returns the component’s settings HTML.
getTriggerHtml() Returns the action’s trigger HTML.
getTriggerLabel() Returns the action’s trigger label.
isDestructive() Returns whether this action is destructive in nature.
isDownload() Returns whether this is a download action.
isSelectable() Returns whether the component should be selectable in component Type selects.
performAction() Performs the action on any elements that match the given criteria.
setElementType() Sets the element type on the action.
settingsAttributes() Returns the list of settings attribute names.

# getConfirmationMessage()

Returns a confirmation message that should be displayed before the action is performed.

View source (opens new window)

Returns

string (opens new window), null (opens new window) – The confirmation message, if any.

# getMessage()

Returns the message that should be displayed to the user after the action is performed.

View source (opens new window)

Returns

string (opens new window), null (opens new window) – The message that should be displayed to the user.

# getTriggerHtml()

Returns the action’s trigger HTML.

View source (opens new window)

Returns

string (opens new window), null (opens new window) – The action’s trigger HTML.

# getTriggerLabel()

Returns the action’s trigger label.

View source (opens new window)

Returns

string (opens new window) – The action’s trigger label

# isDestructive()

Returns whether this action is destructive in nature.

View source (opens new window)

Returns

boolean (opens new window) – Whether this action is destructive in nature.

# isDownload()

Since
3.5.0

Returns whether this is a download action.

Download actions’ performAction() method should call one of these methods before returning true:

View source (opens new window)

Returns

boolean (opens new window) – Whether this is a download action

# performAction()

Performs the action on any elements that match the given criteria.

View source (opens new window)

Arguments

Returns

boolean (opens new window) – Whether the action was performed successfully.

# setElementType()

Sets the element type on the action.

View source (opens new window)

Arguments