In previous versions of Umbraco, I could add custom context menu items to a node by doing something like:
public class RegisterEvents : ApplicationBase { public RegisterEvents() { BaseMediaTree.BeforeNodeRender += new BaseMediaTree.BeforeNodeRenderEventHandler(MediaTree_BeforeNodeRender); }
These events aren't being fired in my build now that I've upgraded to Umbraco 7. Is there guidance on how I can correctly add context menu items to a node, in particular, a media node?
My use case is that I'm developing a 'Copy' feature for Media Items to sit alongside delete, sort, move, etc.
Add context menu item in Umbraco 7
Hi,
In previous versions of Umbraco, I could add custom context menu items to a node by doing something like:
These events aren't being fired in my build now that I've upgraded to Umbraco 7. Is there guidance on how I can correctly add context menu items to a node, in particular, a media node?
My use case is that I'm developing a 'Copy' feature for Media Items to sit alongside delete, sort, move, etc.
Thanks.
You are inheriting from ApplicationBase. That was the way to do it pre version 4.8
For versions higher than 6.1.0 ApplicatinEventHandlers is the way to go.
See the documentation : http://our.umbraco.org/documentation/Reference/Events/application-startup
Hello,
I am having the same issue (umbraco 7.2.2)
public class ApplicationEvents : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
BaseTree.BeforeNodeRender += new BaseTree.BeforeNodeRenderEventHandler(this.BaseTree_BeforeNodeRender);
}
private void BaseTree_BeforeNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e)
{
if (node.Menu != null)
{
}
}
}
the function BaseTree_BeforeNodeRender is never called....
did you find a solution?
I found a solution hooking to the new umbraco 7 tree events
https://our.umbraco.org/documentation/Extending-Umbraco/Section-Trees/trees-v7
is working on a reply...