IconSet ​
- Type
- Abstract Class
- Namespace
- craft\icons
- Inherits
- craft\icons\IconSet » yii\base\BaseObject
- Implements
- yii\base\Configurable
- Extended by
- craft\icons\DirectoryIconSet
- Since
- 5.12.0
IconSet is the base class for custom icon sets, which can be registered via craft\services\Icons::EVENT_REGISTER_ICON_SETS.
Icons selected from a custom icon set are stored as set-handle:icon-name.
Public Properties ​
| Property | Description |
|---|---|
| handle | string – The icon set’s handle, which prefixes the stored values of icons selected from it. |
| icons | string[] |
| name | string – The icon set’s name, as it should be shown in the control panel. |
handle ​
- Type
- string
- Default value
null
The icon set’s handle, which prefixes the stored values of icons selected from it.
Handles must begin with a letter, and can only contain letters, numbers, underscores, and hyphens.
icons ​
- Type
- string[]
- Default value
null- Access
- Read-only
name ​
- Type
- string
- Default value
null
The icon set’s name, as it should be shown in the control panel.
Public Methods ​
| Method | Description |
|---|---|
| __call() | Calls the named method which is not a class method. |
| __construct() | Constructor. |
| __get() | Returns the value of an object property. |
| __isset() | Checks if a property is set, i.e. defined and not null. |
| __set() | Sets value of an object property. |
| __unset() | Sets an object property to null. |
| canGetProperty() | Returns a value indicating whether a property can be read. |
| canSetProperty() | Returns a value indicating whether a property can be set. |
| className() | Returns the fully qualified name of this class. |
| getIcons() | Returns the names of the icons in the set. |
| getKeywords() | Returns search keywords for an icon, in addition to its name. |
| getSvg() | Returns an icon’s SVG markup, or null if the icon doesn’t exist. |
| hasMethod() | Returns a value indicating whether a method is defined. |
| hasProperty() | Returns a value indicating whether a property is defined. |
| init() | Initializes the object. |
getIcons() ​
Returns the names of the icons in the set.
Icon names can’t contain slashes, backslashes, or angle brackets.
Returns ​
string[]
getKeywords() ​
Returns search keywords for an icon, in addition to its name.
Arguments ​
$icon(string) – The icon name
Returns ​
string[]
getSvg() ​
Returns an icon’s SVG markup, or null if the icon doesn’t exist.
Arguments ​
$icon(string) – The icon name