Our customer asked if we can add somekind of special icon to nodes when they are "hidden" by the umbracoNaviHide property. Just like when a node is not published it get the "star/sparkle" icon overlay.
Yes it's possible by hooking into the BaseTree.BeforeNodeRender event.
using umbraco.cms.presentation.Trees; using umbraco.cms.businesslogic.web; using umbraco.BusinessLogic;
public class ChangeIcon : ApplicationBase { public ChangeIcon() { BaseTree.BeforeNodeRender += new BaseTree.BeforeNodeRenderEventHandler(this.BaseTree_BeforeNodeRender); }
private void BaseTree_BeforeNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e) { if (node.NodeType == "content") { if (node.Icon = "icon.png") // quickest way of identifying a node type ! { int nodeId;
if (int.TryParse(node.NodeID, out nodeId)) { // logic here to determine if you want to change the node icon.... // to change the icon: node.Icon = "newIcon.png"; } } } } }
can I change icon on node hidden by navihide ?
Our customer asked if we can add somekind of special icon to nodes when they are "hidden" by the umbracoNaviHide property. Just like when a node is not published it get the "star/sparkle" icon overlay.
Hi Rasmus,
Yes it's possible by hooking into the BaseTree.BeforeNodeRender event.
HTH,
Hendy
That is awesome champ Thx :)
Hello,
this doesn't work in umbraco 7. Has anyone solve this in version 7.1+?
Sören
Use Umbraco.Web.Trees.TreeControllerBase
From here under 'events'
http://our.umbraco.org/documentation/installation/upgrading/v7-upgrade
is working on a reply...