verbb / icon-picker

A Craft CMS field to select SVG or font icons from a folder for use in your content.
Other
17 stars 8 forks source link

Support for Craft SVG Function #15

Closed richhayler closed 5 years ago

richhayler commented 5 years ago

Would be cool if this plugin supported the Craft's SVG function (https://docs.craftcms.com/v3/dev/functions.html#svg)

What would be neat about this is that you could then attach class names to the root SVG element, e.g.

{{ svg(entry.iconPickerField, class='lemon-icon') }}

{{ svg('lemon.svg', class='lemon-icon') }}

engram-design commented 5 years ago

Not sure how feasible it is to 'add support' for it, but you should be able to use {{ svg(entry.iconPickerField.icon, class='lemon-icon') }}

If not, I can add a path attribute that you can feed into this Twig function

engram-design commented 5 years ago

Added in 1.0.8. You can use: {{ svg(entry.iconPickerField.path, class='lemon-icon') }}