public void FillPart(ShareLinkPart part) { var moduleSetting = _orchardServices.WorkContext.CurrentSite.As <ShareLinkModuleSettingPart>(); var partSetting = part.Settings.GetModel <ShareLinkPartSettingVM>(); var tokens = new Dictionary <string, object> { { "Content", part.ContentItem } }; if ((!partSetting.ShowBodyChoise) || part.SharedBody == "") { var s = FillString(partSetting.SharedBody, moduleSetting.SharedBody, tokens); part.SharedBody = ProcessString(s, true); } if ((!partSetting.ShowTextChoise) || part.SharedText == "") { var s = FillString(partSetting.SharedText, moduleSetting.SharedText, tokens); if (!string.IsNullOrWhiteSpace(s)) { part.SharedText = ProcessString(s); } } if ((!partSetting.ShowLinkChoise) || part.SharedLink == "") { var s = FillString(partSetting.SharedLink, moduleSetting.SharedLink, tokens); if (!string.IsNullOrWhiteSpace(s)) { part.SharedLink = ProcessString(s); } } string ListId = ""; if (!(partSetting.ShowImageChoise)) { if (!string.IsNullOrEmpty(partSetting.SharedImage)) { ListId = _tokenizer.Replace(partSetting.SharedImage, tokens); part.SharedImage = GetImgUrl(ListId); } else { if (!string.IsNullOrEmpty(moduleSetting.SharedImage)) { ListId = _tokenizer.Replace(moduleSetting.SharedImage, tokens); part.SharedImage = GetImgUrl(ListId); } } part.SharedIdImage = part.SharedImage.Replace("{", "").Replace("}", ""); part.SharedImage = GetImgUrl(part.SharedIdImage); } }
public int GetPriority(ShareLinkPart part) { var currentId = GetCurrentContentItemId(); return(currentId.HasValue && currentId.Value == part.ContentItem.Id ? 10 : 0); }