Local SVG picker?
r
Hey, I have a folder of svg icons. I want the CMS user to be able to select one from a list or dropdown. Ideally I want the svgs to render so the user can choose visually. To be clear, I don’t want to use the Umbraco icon picker, this is a svg that’s on the file system. Any packages I can use for this? Thanks
c
You can do this with the tag helpers package. There is an svg tag helper in there
r
Thanks Paul. Isn’t Tag Helpers for the front end? I’m trying to render the svg in a property editor in the back end.
c
Sorry. I must have it wrong. I thought you wanted to use a media picker for the svg which will render in the backend and then you can render it on the front end using the tag helper
r
No worries. I probably wasn’t clear! I have a folder of svg icons like: /App_Plugins/icons/countryFlags I want it so that the cms user can select one icon on a property editor from the icons in this directory
l
If you don't want to use the built-in icon picker (just putting your custom svgs in a custom_app/backoffice/icons folder) ... The Contentment package allows you to setup a property that can pull from a folder in the files of the project that you point it at https://marketplace.umbraco.com/package/umbraco.community.contentment
You can create a Data List type, use File System as the data source and set up the location/constraints/etc, then pick a list editor of your choice or template one out that works for your use-case.
c
Yeah, Contentment would be great for it.
r
Thanks both. My first thought was Contentment. I’ve got it working to pick the SVG’s but not sure about how to get them to preview. Good to know I’m on the right path, so will look into the template provided or potentially adding a custom one. I’ll let you know how it goes!
c
This might help. Scroll to the bottom to see the solution. https://skrift.io/issues/creating-an-author-picker-using-contentment/
38 Views