private NavigationLink BuildNavigationLink(DeclaredNode parent, Item child, Item contextItem) { if (!child.IsDerivedFrom(NavigationTemplateIDs.NavigationLinkID)) { LogIncompatibleItemWarning(child); return(null); } NavigationLink link = null; if (child.IsDerivedFrom(NavigationTemplateIDs.ImageNavigationLinkID)) { link = ModelMapper.MapItemToNew <ImageNavigationLink>(child); } else { link = ModelMapper.MapItemToNew <NavigationLink>(child); } link.Parent = parent; if (contextItem == null) { return(link); } if (LinkTargetIsAncestorOfContext(child, contextItem)) { link.IsActive = true; } return(link); }
private LinkGroup BuildLinkGroup(DeclaredNode parent, Item child) { var group = ModelMapper.MapItemToNew <LinkGroup>(child); group.Parent = parent; return(group); }