Custom publish event works for single page publish but not for bulk publishing
So below code works fine when just publishing a single page. But when right-click and publish all subpages (checkbox) it doesnt work for all the childs (which are of the type Person).
I read that in 2014 this was an issue , but i cannot believe that in umbraco 7.5.11 this still doesnt work properly...
Any suggestions?
public class SetUmbracoNaviHideEventHandler : IApplicationEventHandler
{
public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
}
public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
ContentService.Publishing += ContentService_Publishing;
}
private void ContentService_Publishing(IPublishingStrategy sender, PublishEventArgs<Umbraco.Core.Models.IContent> e)
{
//only for Persons set the umbraconavihide property to true by default, if not already.
foreach (var node in e.PublishedEntities)
{
if (node.ContentType.Alias.InvariantEquals(DocumentTypeAliases.Person) && !node.GetValue<bool>("umbracoNaviHide"))
{
node.SetValue("umbracoNaviHide", true);
}
}
}
public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
}
}
Custom publish event works for single page publish but not for bulk publishing
So below code works fine when just publishing a single page. But when right-click and publish all subpages (checkbox) it doesnt work for all the childs (which are of the type Person).
I read that in 2014 this was an issue , but i cannot believe that in umbraco 7.5.11 this still doesnt work properly...
Any suggestions?
is working on a reply...