public override async Task GetInfoAsync(GeMenuItemInput geMenuItemInput) { var itemDataModel = geMenuItemInput.ItemDataModel; var currentRequest = geMenuItemInput.CurrentRequest; var propertyName = itemDataModel.PropertyName; var isPrivate = NewsItemBusinessModule.IsPrivate(propertyName); if (isPrivate && geMenuItemInput.IsSitemap) { return; } var menuItem = await NewsItemBusinessModule.GetMenuItemAsync(_urlProvider, itemDataModel, currentRequest, ModuleName, isPrivate); if (menuItem != null) { //var expendoMenu = CacheProvider.ToExpando(menuItem); { var items = await geMenuItemInput.DataFactory.ItemRepository.GetItemsAsync(itemDataModel.SiteId, new ItemFilters { ParentId = itemDataModel.Id, ExcludedModules = new List <string>() { "Image", "Video" } }); foreach (var dataModel in items) { var menuItemChild = await NewsItemBusinessModule.GetMenuItemAsync(_urlProvider, dataModel, currentRequest, dataModel.Module, isPrivate); if (menuItemChild != null) { if (menuItem.Childs == null) { menuItem.Childs = new List <MenuItemBusiness>(); } menuItem.Childs.Add(menuItemChild); } } } ModuleManager.Add(geMenuItemInput.Master, itemDataModel.PropertyName, menuItem, itemDataModel.PropertyType); } }
public override async Task GetInfoAsync(GeMenuItemInput geMenuItemInput) { if (geMenuItemInput.IsSitemap) { return; } var itemDataModel = geMenuItemInput.ItemDataModel; var moduleId = itemDataModel.Id; var currentRequest = geMenuItemInput.CurrentRequest; var moduleSocial = (SocialBusinessModel)geMenuItemInput.ItemDataModel.Data; string title; if (string.IsNullOrEmpty(moduleSocial.Title)) { switch (moduleSocial.Socials) { case Socials.Phone: title = moduleSocial.Url; break; case Socials.Email: title = moduleSocial.Url; break; default: title = moduleSocial.Socials.ToString(); break; } } else { title = moduleSocial.Title; } var normalizedTitle = UrlHelper.NormalizeTextForUrl(title); var isPrivate = NewsItemBusinessModule.IsPrivate(itemDataModel.PropertyName); object o = new { title = normalizedTitle, moduleId }; if (isPrivate) { o = new { title = normalizedTitle, moduleId, @private = "privee" }; } var urlInfo = await _urlProvider.GetUrlAsync(currentRequest, "Index", ModuleName, o); var menuItem = new MenuItemBusiness(); menuItem.Title = title; menuItem.RouteDatas = NewsItemBusinessModule.GetRouteData(moduleSocial.Socials.ToString(), ModuleName, normalizedTitle, moduleId, itemDataModel.PropertyName); menuItem.TypeMenuItem = TypeMenuItem.Link; string socialUrl = String.IsNullOrEmpty(moduleSocial.Url) ? "#" : moduleSocial.Url; string url = null; if (moduleSocial.Socials == Socials.Phone) { url = "tel:" + socialUrl; } else if (moduleSocial.Socials == Socials.Phone) { url = "mailto:" + socialUrl; } else { url = socialUrl; } menuItem.Url = url; menuItem.RoutePath = url; menuItem.RoutePathWithoutHomePage = urlInfo.RoutePathWithoutHomePage; menuItem.ModuleId = itemDataModel.Id; menuItem.ModuleName = ModuleName; ModuleManager.Add(geMenuItemInput.Master, itemDataModel.PropertyName, menuItem, itemDataModel.PropertyType); }