ElementActionInterface

Type
Interface
Namespace
craft\base
Extends
craft\base\SavableComponentInterface
Implemented by
craft\base\ElementAction, craft\elements\actions\CopyReferenceTag, craft\elements\actions\Delete, craft\elements\actions\DeleteAssets, craft\elements\actions\DeleteUsers, craft\elements\actions\DownloadAssetFile, 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\SetStatus, craft\elements\actions\SuspendUsers, craft\elements\actions\UnsuspendUsers, craft\elements\actions\View
Since
3.0

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

View source

Public Methods

MethodDescription
afterDelete()Performs actions after a component is deleted.
afterSave()Performs actions after a component is saved.
beforeDelete()Performs actions before a component is deleted.
beforeSave()Performs actions before a component is saved.
displayName()Returns the display name of this class.
getConfirmationMessage()Returns a confirmation message that should be displayed before the action is performed.
getIsNew()Returns whether the component is new (unsaved).
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.
isSelectable()Returns whether the component should be selectable in component Type selects.
performAction()Performs the action on any elements that match the given criteria.
settingsAttributes()Returns the list of settings attribute names.
validate()Validates the component.

getConfirmationMessage()

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

View source

Returns

string, null – The confirmation message, if any.

Signature

public abstract string, null getConfirmationMessage ( )

getMessage()

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

View source

Returns

string, null – The message that should be displayed to the user.

Signature

public abstract string, null getMessage ( )

getTriggerHtml()

Returns the action’s trigger HTML.

View source

Returns

string, null – The action’s trigger HTML.

Signature

public abstract string, null getTriggerHtml ( )

getTriggerLabel()

Returns the action’s trigger label.

View source

Returns

string – The action’s trigger label

Signature

public abstract string getTriggerLabel ( )

isDestructive()

Returns whether this action is destructive in nature.

View source

Returns

boolean – Whether this action is destructive in nature.

Signature

public abstract static boolean isDestructive ( )

performAction()

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

View source

Arguments

Returns

boolean – Whether the action was performed successfully.

Signature

public abstract boolean performAction ( craft\elements\db\ElementQueryInterface $query )