SavableComponentInterface

Type
Interface
Namespace
craft\base
Extends
craft\base\ConfigurableComponentInterface
Implemented by
craft\base\Field, craft\base\FieldInterface, craft\base\FlysystemVolume, craft\base\SavableComponent, craft\base\Volume, craft\base\VolumeInterface, craft\base\Widget, craft\base\WidgetInterface, craft\fields\Assets, craft\fields\BaseOptionsField, craft\fields\BaseRelationField, craft\fields\Categories, craft\fields\Checkboxes, craft\fields\Color, craft\fields\Date, craft\fields\Dropdown, craft\fields\Email, craft\fields\Entries, craft\fields\Lightswitch, craft\fields\Matrix, craft\fields\MissingField, craft\fields\MultiSelect, craft\fields\Number, craft\fields\PlainText, craft\fields\RadioButtons, craft\fields\Table, craft\fields\Tags, craft\fields\Time, craft\fields\Url, craft\fields\Users, craft\volumes\Local, craft\volumes\MissingVolume, craft\volumes\Temp, craft\widgets\CraftSupport, craft\widgets\Feed, craft\widgets\MissingWidget, craft\widgets\MyDrafts, craft\widgets\NewUsers, craft\widgets\QuickPost, craft\widgets\RecentEntries, craft\widgets\Updates
Since
3.0.0

SavableComponentInterface defines the common interface to be implemented by savable Craft component classes.

A class implementing this interface should extend craft\base\Model and also use craft\base\SavableComponentTrait.

View source (opens new window)

# Public Methods

Method Description
afterDelete() Performs actions after a component is deleted.
afterSave() Performs actions after a component is saved.
beforeApplyDelete() Performs actions before a component delete is applied to the database.
beforeDelete() Performs actions before a component is deleted.
beforeSave() Performs actions before a component is saved.
displayName() Returns the display name of this class.
getIsNew() Returns whether the component is new (unsaved).
getSettings() Returns an array of the component’s settings.
getSettingsHtml() Returns the component’s settings HTML.
isSelectable() Returns whether the component should be selectable in component Type selects.
settingsAttributes() Returns the list of settings attribute names.

# afterDelete()

Performs actions after a component is deleted.

View source (opens new window)

# afterSave()

Performs actions after a component is saved.

View source (opens new window)

Arguments

# beforeApplyDelete()

Since
3.1.0

Performs actions before a component delete is applied to the database.

View source (opens new window)

# beforeDelete()

Performs actions before a component is deleted.

View source (opens new window)

Returns

boolean (opens new window) – Whether the component should be deleted

# beforeSave()

Performs actions before a component is saved.

View source (opens new window)

Arguments

Returns

boolean (opens new window) – Whether the component should be saved

# getIsNew()

Returns whether the component is new (unsaved).

View source (opens new window)

Returns

boolean (opens new window) – Whether the component is new