Icon#

Whenever you're dealing with an icon in your template, you're actually working with a Icon object.

Attributes#

AttributeDescription
valueThe value of the icon. This will vary depending on the type of icon.
iconSetThe icon set this icon belongs to.
labelThe named representation of the icon.
keywordsThe keywords used to search for the icon by. Defaults to the label.
typeWhat type of icon this is: svg, sprite, glyph or css.
lengthReturn the string length of the icon for the field.

Value#

To normalise the behaviour of an Icon object, we use a value attribute as the main value to identify the icon within the icon set. This will vary depending on the type of icon this is.

TypeDescriptionExample
svgThe filename and relative path of the icon./my-folder/twitter-square.svg
spriteThe name of the sprite within the spritesheet.twitter-square
glyphThe font glyph name and glyph decimal.twitter-square:61569
cssThe name of the icon for the remote icon source. Commonly a CSS class.twitter-square

Methods#

MethodDescription
isEmpty()Returns whether or not there's an icon selected for this field.
getUrl()Return the full URL to the icon. SVG Icons only.
getPath()Return the full path to the icon. SVG Icons only.
getInline()Returns the raw contents of the icon. SVG Icons only.
getGlyph(format)Returns the character representation of a font glyph. Icon Font only.
getGlyphName()Returns the named representation of a font glyph. Icon Font only.

Glyph formats#

FormatExample
getGlyph('decimal')Get the icon unicode (decimal).
getGlyph('hex')Get the icon unicode (hexadecimal).
getGlyph('char')Display the icon as html character - &#00000.
getGlyph('charHex')Display the icon as html character hex - &#xf100. Default

Previous ← Available Variables Next Icon Sets →