SavableComponentInterface

Type
Interface
Namespace
craft\base
Extends
craft\base\ConfigurableComponentInterface
Implemented by
craft\base\Field, craft\base\FieldInterface, craft\base\Fs, craft\base\FsInterface, craft\base\SavableComponent, 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\Country, craft\fields\Date, craft\fields\Dropdown, craft\fields\Email, craft\fields\Entries, craft\fields\Lightswitch, craft\fields\Matrix, craft\fields\MissingField, craft\fields\Money, 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\fs\Local, craft\fs\MissingFs, craft\fs\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.
extraFields() (opens new window) Returns the list of additional fields that can be returned by toArray() (opens new window) in addition to those listed in fields() (opens new window).
fields() (opens new window) Returns the list of fields that should be returned by default by toArray() (opens new window) when no specific fields are specified.
getIsNew() Returns whether the component is new (unsaved).
getSettings() Returns an array of the component’s settings.
getSettingsHtml() Returns the component’s settings HTML.
instance() (opens new window) Returns static class instance, which can be used to obtain meta information.
isSelectable() Returns whether the component should be selectable in component Type selects.
settingsAttributes() Returns the list of settings attribute names.
toArray() (opens new window) Converts the object into an array.

# 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