public static class IBaseLogbookEntryExtensions
{
public static LogbookLandingPage GetLogbookLandingPage(this IBaseLogbookEntry entry)
{
Item currentItem = Sitecore.Context.Database.GetItem(new ID(entry.Id));
return GetLogbookLandingPageRecursive(currentItem);
}
private static LogbookLandingPage GetLogbookLandingPageRecursive(Item currentItem)
{
if (currentItem == null)
{
return null;
}
if (currentItem.TemplateID == ILogbookLandingPageConstants.TemplateId)
{
return currentItem.GlassCast<LogbookLandingPage>();
}
return GetLogbookLandingPageRecursive(currentItem.Parent);
}
}
----------------------------------------------------------------------
No comments:
Post a Comment