WidgetInterface

Type
Interface
Namespace
craft\base
Extends
craft\base\SavableComponentInterface
Implemented by
craft\base\Widget, craft\widgets\CraftSupport, craft\widgets\Feed, craft\widgets\MissingWidget, craft\widgets\NewUsers, craft\widgets\QuickPost, craft\widgets\RecentEntries, craft\widgets\Updates
Since
3.0

WidgetInterface defines the common interface to be implemented by dashboard widget classes.

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

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.
getBodyHtml()Returns the widget's body HTML.
getIsNew()Returns whether the component is new (unsaved).
getSettings()Returns an array of the component’s settings.
getSettingsHtml()Returns the component’s settings HTML.
getTitle()Returns the widget’s title.
iconPath()Returns the path to the widget’s SVG icon.
isSelectable()Returns whether the component should be selectable in component Type selects.
maxColspan()Returns the widget’s maximum colspan.
settingsAttributes()Returns the list of settings attribute names.
validate()Validates the component.

getBodyHtml()

Returns the widget's body HTML.

View source

Returns

string, false – The widget’s body HTML, or false if the widget should not be visible. (If you don’t want the widget to be selectable in the first place, use isSelectable().)

Signature

public abstract string, false getBodyHtml ( )

getTitle()

Returns the widget’s title.

View source

Returns

string – The widget’s title.

Signature

public abstract string getTitle ( )

iconPath()

Returns the path to the widget’s SVG icon.

View source

Returns

string, null – The path to the widget’s SVG icon

Signature

public abstract static string, null iconPath ( )

maxColspan()

Returns the widget’s maximum colspan.

View source

Returns

integer, null – The widget’s maximum colspan, if it has one

Signature

public abstract static integer, null maxColspan ( )