Hi,
I'm trying to find out which language branch an editor is trying to delete by using the DeletingPageLanguage event. I expect the information to be available in the args parameter. The SDK documentation could be interpreted to suggest that PageLanguageEventArgs.LanguageBranch contain the id of the language which is being deleted, but it's always set to "en" (same as MasterLanguageBranch).
I have to use this event because I need to be able to cancel the delete action under certain conditions.
Does anyone have a solution to my problem?
The code I use is:
protected void Application_Start(Object sender, EventArgs e)
{
EPiServer.DataFactory.Instance.DeletingPageLanguage += new PageEventHandler(Instance_DeletingPageLanguage);
}
public void Instance_DeletingPageLanguage(object sender, PageEventArgs args)
{
PageLanguageEventArgs langArgs = args as PageLanguageEventArgs;
string someImportantLanguage = "sv";
// langArgs.LanguageBranch is ALWAYS "en". Why?!?!
if(langArgs.LanguageBranch == someImportantLanguage)
{
args.CancelAction = true;
args.CancelReason = "this language is to important, yada yada yada...";
}
}
Any help would be much appreciated.
Thanks!
Best regards,
Johan Öhrn