Changing doctype icon color programatically
# help-with-umbraco
s
Is it possible to change the icon color of a document programatically based on a property? I would want this to be purple, instead of green based on if a value is selected. https://cdn.discordapp.com/attachments/1235173325886722118/1235173326242971699/image.png?ex=6633684d&is=663216cd&hm=69a83cb3c35cde4d02ed227be2e7345c7ac2d395ea9727941c83ba025704a5b0&
s
Wonder if you can do something with
TreeNodesRenderingNotification
- but careful, that could mean a lot of querying? Especially if it's not published content. I know in the list view you can do quite a few things with rendering custom views, might be an option instead?
s
List view is a no-go, unfortunately. I think you're right - it might be a lot of querying that'll probably slow everything down to the point where it might not be worth.
s
I know people add icon overlays, just can't remember who it was.. I'm pretty sure @leekelleher could point you in the right direction.
s
oooh
l
We made a package for v4 (at an umBristol hackathon!) called Page State Icons, and then for v7 Nathan did one called Stately https://our.umbraco.com/packages/backoffice-extensions/page-state-icons/ https://our.umbraco.com/packages/backoffice-extensions/stately/ both of these hooked into the
TreeNodesRendering
event, (which would now be
TreeNodesRenderingNotification
, as Seb said), then it was a case of querying the menu item's corresponding node and looking up property values and setting the icon accordingly. In terms of performance, could add caching for the node's ID and icon, and expire it on document save notification?
6 Views