public async Task <JsonResult> GetNavMenuItemContent([DataSourceRequest] DataSourceRequest request, string contentType, string id = null) { var a = Request; var siteId = Site.Id; IEnumerable <NavMenuItemContent> content; var provider = _navigationMenuManager.GetNavMenuContentProvider(contentType); if (provider == null) { content = new List <NavMenuItemContent>(); } else if (string.IsNullOrEmpty(id)) { content = provider.GetRootItems(siteId); } else { // There is no way to pass the correct contentType when the TreeView expands a node. So, get it from the parent node. //provider = _navigationMenuManager.GetNavMenuContentProviderOfContentId(id); //if (provider == null) // content = new List<NavMenuItemContent>(); //else content = provider.GetChildItems(siteId, id); } var list = content.Select(x => new { id = x.Id, name = x.Title, description = x.Description, hasChildren = x.HasChildren }).ToList(); return(Json(list)); }
private string GetContentTitle(string contentType, string contentId) { var provider = _navigationMenuManager.GetNavMenuContentProvider(contentType); if (provider == null) { return(string.Empty); } var item = provider.GetContentItem(contentId); if (item == null) { return(string.Empty); } return(item.Title); }