/// <inheritdoc /> public virtual FeedViewModel GetViewModel() { var viewModel = new FeedViewModel(); viewModel.InsertionOption = this.InsertionOption; viewModel.CssClass = this.CssClass; if (this.FeedId != null && this.FeedId != Guid.Empty) { RssPipeSettings pipe = PublishingManager.GetManager().GetPipeSettings<RssPipeSettings>().Where(p => p.Id == this.FeedId).FirstOrDefault(); if (pipe != null) { string url = RouteHelper.ResolveUrl(String.Concat("~/", Config.Get<PublishingConfig>().FeedsBaseURl, "/", pipe.UrlName), UrlResolveOptions.Absolute); string title = (!string.IsNullOrEmpty(this.TextToDisplay)) ? HttpUtility.HtmlEncode(this.TextToDisplay) : string.Empty; if (this.InsertionOption == FeedInsertionOption.AddressBarOnly || this.InsertionOption == FeedInsertionOption.PageAndAddressBar) { viewModel.HeadLink = string.Format( CultureInfo.CurrentCulture, @"<link rel=""alternate"" type=""application/rss+xml"" title=""{0}"" href=""{1}""/>", title, url); } if (this.InsertionOption == FeedInsertionOption.PageOnly || this.InsertionOption == FeedInsertionOption.PageAndAddressBar) { viewModel.Title = title; viewModel.Url = url; viewModel.Tooltip = this.Tooltip; viewModel.OpenInNewWindow = this.OpenInNewWindow; } } } return viewModel; }
/// <inheritdoc /> public virtual FeedViewModel GetViewModel() { var viewModel = new FeedViewModel(); viewModel.InsertionOption = this.InsertionOption; viewModel.CssClass = this.CssClass; if (this.FeedId != null && this.FeedId != Guid.Empty) { RssPipeSettings pipe = PublishingManager.GetManager().GetPipeSettings <RssPipeSettings>().Where(p => p.Id == this.FeedId).FirstOrDefault(); if (pipe != null) { string url = RouteHelper.ResolveUrl(String.Concat("~/", Config.Get <PublishingConfig>().FeedsBaseURl, "/", pipe.UrlName), UrlResolveOptions.Absolute); string title = (!string.IsNullOrEmpty(this.TextToDisplay)) ? HttpUtility.HtmlEncode(this.TextToDisplay) : string.Empty; if (this.InsertionOption == FeedInsertionOption.AddressBarOnly || this.InsertionOption == FeedInsertionOption.PageAndAddressBar) { viewModel.HeadLink = string.Format( CultureInfo.CurrentCulture, @"<link rel=""alternate"" type=""application/rss+xml"" title=""{0}"" href=""{1}""/>", title, url); } if (this.InsertionOption == FeedInsertionOption.PageOnly || this.InsertionOption == FeedInsertionOption.PageAndAddressBar) { viewModel.Title = title; viewModel.Url = url; viewModel.Tooltip = this.Tooltip; viewModel.OpenInNewWindow = this.OpenInNewWindow; } } } return(viewModel); }