This module lets you assign icons to a DataObject using
SVG Sprites. It can be configured to use a default sprite
file or a custom sprite file can be on a per-field basis. This module is heavily based on
jaedb/IconField and if you need a solution that used multiple image files for
icons you should use th one.
SilverStripe CMS ^4.2
Silverstripe SVG ^2 (for inlining Sprites)
composer require thezenmonkey/silverstripe-svgspritefield
The Sprite field is a subclass of OptionSetField and takes the same parameters with a SVG Sprite File being used as the
source array.
SpriteField::create($name, $title, $iconFolder)
The module will use the symbol
as the value stored in your database. The <title>
provides the Name od the
Icon.
To use in you theme use the stndard SVG use markup with $Value as the name of your DataBase field
<svg viewBox="0 0 100 100" class="icon">
<use xlink:href="#{$Value}" />
</svg>
Ensure you include the SVG source file somewhere on the page set to display none
{$SVG('mysource.svg').customBasePath('my/base/path').extraClass('myhiddenclass')}
Please see SilverStripe SVG for correct implementation.
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem