This plugin requires Craft CMS 3.0.0-beta.23 or later.
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Add Github repo to your
composer.json
"repositories": [ { "type":"git", "url":"https://github.com/simple-integrated-marketing/svg-picker.git" } ]
-
Then tell Composer to load the plugin:
composer require "simple-team/svg-picker:dev-master"
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for Svg Picker.
Svg Picker field is the id of the icon.
Example usage:
<svg>
<use xlink:href="#{{entry.svgIcon}}">
</svg>
There are 3 ways you could "import" svg definition file into the DOM.
-
Manually reference external css/js like Icomoon. Note that you are responsible to keep the icons in sync with the setting.
-
Use
{{ inlineSvgDefsContent() }}
to import the the svg definitions inline, or{{ inlineSvgDefsContent({sets:['SETNAME']}) }}
to only inline a list of specific sets. -
Use
{{ ajaxSvgDefsContent() }}
to ajax the svg definitions via javascript, or{{ ajaxSvgDefsContent({sets:['SETNAME']}) }}
to only ajax a list of specific sets.
Brought to you by Simple Integrated Marketing