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\MyDrafts, craft\widgets\NewUsers, craft\widgets\QuickPost, craft\widgets\RecentEntries, craft\widgets\Updates
- Since
- 3.0.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.
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. |
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. |
getSubtitle() | Returns the widget’s subtitle. |
getTitle() | Returns the widget’s title. |
icon() | Returns the path to the widget’s SVG icon, or the actual SVG contents. |
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. |
getBodyHtml()
​
Returns the widget's body HTML.
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().)
getSubtitle()
​
- Since
- 3.4.0
Returns the widget’s subtitle.
Returns ​
string, null – The widget’s subtitle
getTitle()
​
Returns the widget’s title.
Returns ​
string – The widget’s title.
icon()
​
- Since
- 3.2.0
Returns the path to the widget’s SVG icon, or the actual SVG contents.
Returns ​
maxColspan()
​
Returns the widget’s maximum colspan.
Returns ​
integer, null – The widget’s maximum colspan, if it has one