public KenticoNavigationRepository(string cultureName, bool latestVersionEnabled, IOutputCacheDependencies cacheDependencies, IGeneralDocumentRepository GeneralDocumentRepository, IKenticoNavigationRepositoryHelper Helper)
 {
     this.cultureName          = cultureName;
     this.latestVersionEnabled = latestVersionEnabled;
     this.cacheDependencies    = cacheDependencies;
     _GeneralDocumentRepo      = GeneralDocumentRepository;
     _helper = Helper;
 }
        public NavigationItem GetTreeNodeToNavigationItem(HierarchyTreeNode HierarchyNavTreeNode)
        {
            IKenticoNavigationRepositoryHelper _CachableSelfHelper = DependencyResolver.Current.GetService <IKenticoNavigationRepositoryHelper>();
            NavigationItem NavItem = new NavigationItem();

            if (HierarchyNavTreeNode.Page is Navigation)
            {
                Navigation NavTreeNode = (Navigation)HierarchyNavTreeNode.Page;
                switch ((NavigationTypeEnum)(NavTreeNode.NavigationType))
                {
                case NavigationTypeEnum.Automatic:
                    if (NavTreeNode.NavigationPageNodeGuid != Guid.Empty)
                    {
                        var TempNavItem = _CachableSelfHelper.GetTreeNodeToNav(NavTreeNode.NavigationPageNodeGuid);
                        // Convert to a new navigation item so it's not linked to the cached memory object, specifically the Children List
                        NavItem = _Mapper.Map <NavigationItem>(TempNavItem);
                    }
                    else
                    {
                        NavItem.LinkText   = NavTreeNode.NavigationLinkText;
                        NavItem.LinkTarget = NavTreeNode.NavigationLinkTarget;
                        NavItem.LinkHref   = NavTreeNode.NavigationLinkUrl;
                    }
                    break;

                case NavigationTypeEnum.Manual:
                default:
                    NavItem.LinkText   = NavTreeNode.NavigationLinkText;
                    NavItem.LinkTarget = NavTreeNode.NavigationLinkTarget;
                    NavItem.LinkHref   = NavTreeNode.NavigationLinkUrl;
                    break;
                }
                // Add additional items
                NavItem.IsMegaMenu   = NavTreeNode.NavigationIsMegaMenu;
                NavItem.LinkCSSClass = NavTreeNode.NavigationLinkCSS;
                NavItem.LinkOnClick  = NavTreeNode.NavigationLinkOnClick;
                NavItem.LinkAlt      = NavTreeNode.NavigationLinkAlt;
                NavItem.LinkPagePath = NavTreeNode.NodeAliasPath;
            }
            else
            {
                // Create navigation item from page manually
                NavItem = _Mapper.Map <NavigationItem>(HierarchyNavTreeNode.Page);
            }

            // Add children
            foreach (var HierarchyChild in HierarchyNavTreeNode.Children)
            {
                NavItem.Children.Add(GetTreeNodeToNavigationItem(HierarchyChild));
            }
            return(NavItem);
        }
 public KenticoNavigationRepository(IGeneralDocumentRepository GeneralDocumentRepository, IKenticoNavigationRepositoryHelper Helper)
 {
     _GeneralDocumentRepo = GeneralDocumentRepository;
     _helper = Helper;
 }