private NavigationItem CreatNavigationItem(PageData x) { var navItem = new NavigationItem() { Name = x.Name, Link = x.LinkURL }; return navItem; }
public List<NavigationItem> GetMainMenu() { var navigationItems = new List<NavigationItem>(); var urlHelper = ServiceLocator.Current.GetInstance<UrlResolver>(); var menuContainer = _epiServerDependencies.ContentRepository .GetChildren<MenuContainer>(ContentReference.RootPage) .FirstOrDefault(); var menuPages = _epiServerDependencies.ContentRepository .GetChildren<MenuPage>(menuContainer.ContentLink); foreach(var menuPage in menuPages) { var navigationItem = new NavigationItem(); navigationItem.Name = menuPage.MainMenuTitle; navigationItem.SubMenuTitle = menuPage.SubMenuTitle; navigationItem.ImageUrl = menuPage.MenuImageUrl.ToString(); var subMenuPages = _epiServerDependencies.ContentRepository .GetChildren<SubMenuPage>(menuPage.ContentLink); foreach(var subMenuPage in subMenuPages) { var subNavigationItem = new NavigationItem { Name = subMenuPage.Name, Link = subMenuPage.LinkUrl.ToString() }; navigationItem.SubMenuItems.Add(subNavigationItem); } navigationItems.Add(navigationItem); } return navigationItems; }