Custom document type icons for same document type?
# help-with-umbraco
s
I have no idea if this would even be possible, but most often we use the same document type for all pages, headless with block list for components. However for UX purposes having different icons for different pages would be beneficial. See image: https://cdn.discordapp.com/attachments/1229385508027629600/1229385508229091368/image.png?ex=662f7d7a&is=661d087a&hm=69ada2eac4ff0f5a79f582c68a392fc8d9854aefc05eec722062c434f7a5cff9&
And yes, i know i could add two document types with two different icons, inheriting the same composition. But just asking if this would even be possible.
c
I've seen it done before. You need to hook into the tree nodes rendering notification handler or something like that. https://docs.umbraco.com/umbraco-cms/extending/section-trees/trees#treenodesrenderingnotification
s
Okay interesting, thanks Paul 🙂
Here you can see they are setting the icon.
s
Okay, so it uses a font?
Umbraco icons font?
c
There is an icon picker data type in the Contentment package which might help with this. You might be able to get the icon name from the picked icon
n
The Icons are SVG's, and I believe they have to exist in a specific location in the file system.
m
I wrote something called content node icons—lets you set and unset custom icons on nodes. If you’d like to see the latest code I can send it over to you. I haven’t released the latest as a package yet—but it expands beyond the content section and allows setting almost any icon in any tree.
4 Views