Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm trying to hide menu items for a certain DocType is in the tree, however the code below doesn't work as Node.NodeType returns "content" or "media"
How can I get the DocTypeAlias?
I'm using 4.5.2
public class EnterprisePermissions : ApplicationBase { string donotdeletealias = "textpage"; public EnterprisePermissions() { umbraco.cms.presentation.Trees.BaseTree.BeforeNodeRender += new umbraco.cms.presentation.Trees.BaseTree.BeforeNodeRenderEventHandler(BaseTree_BeforeNodeRender); } void BaseTree_BeforeNodeRender(ref umbraco.cms.presentation.Trees.XmlTree sender, ref umbraco.cms.presentation.Trees.XmlTreeNode node, EventArgs e) { if (node.NodeType == donotdeletealias) { node.Menu.Actions.Remove(umbraco.BusinessLogic.Actions.ActionDelete.Instance); } } }
The code above is from here http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/event-examples/remove-context-menu-items
Cheers
Rich
I figured this out, however would be very interested to know if this the best way and also if the Wiki page is incorrect?
umbraco.presentation.nodeFactory.Node treeNode = new umbraco.presentation.nodeFactory.Node(Convert.ToInt32(node.NodeID)); Log.Add(LogTypes.Custom, -1, "Node type Alias" + treeNode.NodeTypeAlias);
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Hiding specific DocTypes when rendering tree
I'm trying to hide menu items for a certain DocType is in the tree, however the code below doesn't work as Node.NodeType returns "content" or "media"
How can I get the DocTypeAlias?
I'm using 4.5.2
The code above is from here http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/event-examples/remove-context-menu-items
Cheers
Rich
I figured this out, however would be very interested to know if this the best way and also if the Wiki page is incorrect?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.