Skip to content

UtilityInterface

Type
Interface
Namespace
craft\base
Extends
craft\base\ComponentInterface
Implemented by
craft\base\Utility, craft\utilities\AssetIndexes, craft\utilities\ClearCaches, craft\utilities\DbBackup, craft\utilities\DeprecationErrors, craft\utilities\FindAndReplace, craft\utilities\Migrations, craft\utilities\PhpInfo, craft\utilities\ProjectConfig, craft\utilities\QueueManager, craft\utilities\SystemMessages, craft\utilities\SystemReport, craft\utilities\Updates, craft\utilities\Upgrade
Since
3.0.0

UtilityInterface defines the common interface to be implemented by utility classes.

View source

Public Methods

MethodDescription
badgeCount()Returns the number that should be shown in the utility’s nav item badge.
contentHtml()Returns the utility's content HTML.
displayName()Returns the display name of this class.
extraFields()Returns the list of additional fields that can be returned by toArray() in addition to those listed in fields().
fields()Returns the list of fields that should be returned by default by toArray() when no specific fields are specified.
footerHtml()Returns the utility’s footer HTML.
icon()Returns the utility’s SVG icon, if it has one.
id()Returns the utility’s unique identifier.
instance()Returns static class instance, which can be used to obtain meta information.
isSelectable()Returns whether the component should be selectable in component Type selects.
toArray()Converts the object into an array.
toolbarHtml()Returns the utility’s toolbar HTML.

badgeCount()

Returns the number that should be shown in the utility’s nav item badge.

If 0 is returned, no badge will be shown

View source

Returns

integer

contentHtml()

Returns the utility's content HTML.

View source

Returns

string

footerHtml()

Since
3.4.0

Returns the utility’s footer HTML.

View source

Returns

string

icon()

Since
5.0.0

Returns the utility’s SVG icon, if it has one.

The returned icon can be a system icon’s name (e.g. 'whiskey-glass-ice'), the path to an SVG file, or raw SVG markup.

System icons can be found in src/icons/solid/.

View source

Returns

string, null

id()

Returns the utility’s unique identifier.

The ID should be in kebab-case, as it will be visible in the URL (admin/utilities/the-handle).

View source

Returns

string

toolbarHtml()

Since
3.4.0

Returns the utility’s toolbar HTML.

View source

Returns

string