Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Mar 06, 2012 @ 12:35
    Rasmus Fjord
    0

    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.

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Mar 06, 2012 @ 13:24
    Hendy Racher
    1

    Hi Rasmus,

    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";
            }
          }
        }
      }
    }

    HTH,

    Hendy

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Mar 06, 2012 @ 13:27
    Rasmus Fjord
    0

    That is awesome champ Thx :)

  • Sören Deger 733 posts 2844 karma points c-trib
    Oct 31, 2014 @ 10:57
    Sören Deger
    0

    Hello,

    this doesn't work in umbraco 7. Has anyone solve this in version 7.1+? 

     

    Sören

     

     

  • Lewis 27 posts 90 karma points
    Nov 10, 2014 @ 17:36
    Lewis
    0

    Use Umbraco.Web.Trees.TreeControllerBase

    From here under 'events'

    http://our.umbraco.org/documentation/installation/upgrading/v7-upgrade

Please Sign in or register to post replies

Write your reply to:

Draft