Craft 3 Class Reference

Interface craft\base\WidgetInterface

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
Available since version
3.0
Source Code
https://github.com/craftcms/cms/blob/master/src/base/WidgetInterface.php

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 Defined By
afterDelete() Performs actions after a component is deleted. craft\base\SavableComponentInterface
afterSave() Performs actions after a component is saved. craft\base\SavableComponentInterface
beforeDelete() Performs actions before a component is deleted. craft\base\SavableComponentInterface
beforeSave() Performs actions before a component is saved. craft\base\SavableComponentInterface
displayName() Returns the display name of this class. craft\base\ComponentInterface
getBodyHtml() Returns the widget's body HTML. craft\base\WidgetInterface
getIsNew() Returns whether the component is new (unsaved). craft\base\SavableComponentInterface
getSettings() Returns an array of the component’s settings. craft\base\SavableComponentInterface
getSettingsHtml() Returns the component’s settings HTML. craft\base\SavableComponentInterface
getTitle() Returns the widget’s title. craft\base\WidgetInterface
iconPath() Returns the path to the widget’s SVG icon. craft\base\WidgetInterface
isSelectable() Returns whether the component should be selectable in component Type selects. craft\base\SavableComponentInterface
maxColspan() Returns the widget’s maximum colspan. craft\base\WidgetInterface
settingsAttributes() Returns the list of settings attribute names. craft\base\SavableComponentInterface
validate() Validates the component. craft\base\SavableComponentInterface

Method Details

getBodyHtml() public abstract method #

Returns the widget's body HTML.

public abstract string, false getBodyHtml ( )
return 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().)

getTitle() public abstract method #

Returns the widget’s title.

public abstract string getTitle ( )
return string The widget’s title.

iconPath() public abstract static method #

Returns the path to the widget’s SVG icon.

public abstract static string, null iconPath ( )
return string, null The path to the widget’s SVG icon

maxColspan() public abstract static method #

Returns the widget’s maximum colspan.

public abstract static integer, null maxColspan ( )
return integer, null The widget’s maximum colspan, if it has one