Skip to content

Instantly share code, notes, and snippets.

@sitereactor
Created June 5, 2013 13:39
Show Gist options
  • Save sitereactor/5713911 to your computer and use it in GitHub Desktop.
Save sitereactor/5713911 to your computer and use it in GitHub Desktop.
Very basic example of removing a node from the Content tree by a DocumentType alias.
using System;
using umbraco.BusinessLogic;
using umbraco.cms.presentation.Trees;
public class SecrectContent : ApplicationBase
{
public SecrectContent()
{
BaseContentTree.AfterNodeRender += BaseContentTree_AfterNodeRender;
}
void BaseContentTree_AfterNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e)
{
if(node.NodeType == "myDocTypeAlias")
sender.Remove(node);
}
}
@jesperordrup
Copy link

That will get me startet. Quick note: NodeType is not doctype :-) (content, media,...) but I figure it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment