I have a snippet of code that I use to (try to) hook into events in Umbraco BackOffice.
So far I have successfully been able to let the users create menu items while creating content, and also establised/saved the relation between the newly created menu item and the content created at the same time. The new menu item is placed where the user chooses by picking in the menu tree and gets the name/title/.Text of the content node.
I have some additional functionality that I hope to be able to achieve though:
Avoid duplicate entries of menu items on new saves/publishes of an already existing node.
Give the menu item published/unpublished state equal to that of the content node.
If node title is updated, how can I update the corresponding menu item, rather than have the code create an entirely new menu item?
If, from the menu item, the relation is changed (ie the content node is removed from the content picker), how can I make sure to update the actual relation and also remove the choice that has previously been made within the picker (menu tree) on the content node?I have started looking into hooking into the BeforeSave event for this, but this is not reflected in the below code snippet.
Here is the code I currently have:
namespace Umbraco.Extensions.EventHandlers { public class SaveContentHook : IApplicationEventHandler { public void OnApplicationInitialized(UmbracoApplicationBase httpApplication, ApplicationContext applicationContext) { }
public void OnApplicationStarting(UmbracoApplicationBase httpApplication, ApplicationContext applicationContext) { }
Menu item on node creation and relations/states
Hi all!
I have a snippet of code that I use to (try to) hook into events in Umbraco BackOffice.
So far I have successfully been able to let the users create menu items while creating content, and also establised/saved the relation between the newly created menu item and the content created at the same time. The new menu item is placed where the user chooses by picking in the menu tree and gets the name/title/.Text of the content node.
I have some additional functionality that I hope to be able to achieve though:
Here is the code I currently have:
Please excuse any errors, this is my first endavour hooking into Umbraco like this.
Any hints or tips to get me in the right direction concerning any of my pointers above, are received gratefully.
Thanks in advance,
Anna
I completely forgot, but version info here: Umbraco v6.0.2
//Cheers
is working on a reply...