I am working on a new package and want to add a new context menu item to the media section only.
I am currently adding the context menu item using BaseContentTree.BeforeNodeRender but it appears in teh content menu as well - any help would be appreciated.
To only add my context menu item to the media tree nodes I simply needed to check that:
node.NodeType.ToLower() == "media"
The second issue is still unresolved and I am almost at a dead end with it. I need to add my context menu item to the root media node and can find no way to achieve this so if anyone has any ideas I would appreciate some pointers.
Thanks very much Peter, that link was a huge help. I think I will write up a blog post about this as it has been quite a headache to get to this point. Here is my final override method in the meantime in case it helps someone else.
protected override void CreateRootNodeActions(ref List<IAction> actions)
{
base.CreateAllowedActions(ref actions);
//- Clone the base actions
List<IAction> rootNodeActions = new List<IAction>(actions);
//- Clear the list so we can inject our new menu item where we want it
actions.Clear();
//- Iterate through the base actions
foreach (IAction action in rootNodeActions)
{
actions.Add(action);
if (action.Alias.ToLower() == "sort")
{
//- Add our new action in required location
actions.Add(SortAction.Instance);
}
}
I can finally start putting the finishing touches to my package.
Adding a new context menu item to media section
I am working on a new package and want to add a new context menu item to the media section only.
I am currently adding the context menu item using BaseContentTree.BeforeNodeRender but it appears in teh content menu as well - any help would be appreciated.
Thanks
In addition I would like my context menu to appear on the root element as well which it currently doesn't, only children of the root node
Ok, 1 of my 2 problems now sorted.
To only add my context menu item to the media tree nodes I simply needed to check that:
The second issue is still unresolved and I am almost at a dead end with it. I need to add my context menu item to the root media node and can find no way to achieve this so if anyone has any ideas I would appreciate some pointers.
Thanks
If you use IAction to add new item you can override CreateRootNode on your tree. There is nice tutorial in wiki
http://our.umbraco.org/wiki/reference/backoffice-apis/tree-api-to-create-custom-treesapplications
( Edited as the URL was broken - Chris )
Thanks very much Peter, that link was a huge help. I think I will write up a blog post about this as it has been quite a headache to get to this point. Here is my final override method in the meantime in case it helps someone else.
I can finally start putting the finishing touches to my package.
is working on a reply...