public virtual LayoutModel CreateLayoutModel(ContentReference currentContentLink, RequestContext requestContext) { var startPageContentLink = SiteDefinition.Current.StartPage; // Use the content link with version information when editing the startpage, // otherwise the published version will be used when rendering the props below. if (currentContentLink.CompareToIgnoreWorkID(startPageContentLink)) { startPageContentLink = currentContentLink; } var startPage = _contentLoader.Get<StartPage>(startPageContentLink); return new LayoutModel { Logotype = startPage.SiteLogotype, LogotypeLinkUrl = new MvcHtmlString(_urlResolver.GetUrl(SiteDefinition.Current.StartPage)), ProductPages = startPage.ProductPageLinks, CompanyInformationPages = startPage.CompanyInformationPageLinks, NewsPages = startPage.NewsPageLinks, CustomerZonePages = startPage.CustomerZonePageLinks, LoggedIn = requestContext.HttpContext.User.Identity.IsAuthenticated, LoginUrl = new MvcHtmlString(GetLoginUrl(currentContentLink)), SearchActionUrl = new MvcHtmlString(EPiServer.Web.Routing.UrlResolver.Current.GetUrl(startPage.SearchPageLink)) }; }
public PermanentContentLinkMap Find(EPiServer.Core.ContentReference contentReference) { var pageMaps = _linkMaps.Where(map => map is PermanentContentLinkMap).Cast <PermanentContentLinkMap>(); return(pageMaps.SingleOrDefault(map => contentReference.CompareToIgnoreWorkID(map.ContentReference))); }
protected override Web.ContentResolveResult ResolveContent(ContentReference contentLink) { var contentData = ContentCoreDataLoader.Service.Load(contentLink.ID); // All pages but the entry root should appear to come from this content provider if (!contentLink.CompareToIgnoreWorkID(EntryRoot)) { contentData.ContentReference.ProviderName = ProviderKey; } var result = CreateContentResolveResult(contentData); if (!result.ContentLink.CompareToIgnoreWorkID(EntryRoot)) { result.ContentLink.ProviderName = ProviderKey; } return result; }
protected virtual HrefLangData CreateHrefLangData(ContentReference contentLink, CultureInfo language, CultureInfo masterLanguage) { string languageUrl = UrlResolver.GetUrl(contentLink, language.Name); string masterLanguageUrl = UrlResolver.GetUrl(contentLink, masterLanguage.Name); var data = new HrefLangData(); if (languageUrl.Equals(masterLanguageUrl) && contentLink.CompareToIgnoreWorkID(this.SiteSettings.StartPage)) { data.HrefLang = "x-default"; } else { data.HrefLang = language.Name.ToLowerInvariant(); } data.Href = GetAbsoluteUrl(languageUrl); return data; }
protected override Uri ConstructContentUri(int contentTypeId, ContentReference contentLink, Guid contentGuid) { if (!contentLink.CompareToIgnoreWorkID(EntryRoot)) { contentLink.ProviderName = ProviderKey; } return base.ConstructContentUri(contentTypeId, contentLink, contentGuid); }
protected override IList<ContentReference> LoadChildrenReferences(ContentReference contentLink, string languageID, out bool languageSpecific) { // If retrieving children for the entry point, we retrieve pages from the clone root contentLink = contentLink.CompareToIgnoreWorkID(EntryRoot) ? CloneRoot : contentLink; FilterSortOrder sortOrder; var children = ContentStore.LoadChildrenReferences(contentLink.ID, languageID, out sortOrder); languageSpecific = sortOrder == FilterSortOrder.Alphabetical; foreach (var contentReference in children.Where(contentReference => !contentReference.CompareToIgnoreWorkID(EntryRoot))) { contentReference.ProviderName = ProviderKey; } return FilterByCategory(children); }
public override IList<ContentReference> GetDescendentReferences(ContentReference contentLink) { // If retrieving children for the entry point, we retrieve pages from the clone root contentLink = contentLink.CompareToIgnoreWorkID(EntryRoot) ? CloneRoot : contentLink; var descendents = ContentStore.ListAll(contentLink); foreach (var contentReference in descendents.Where(contentReference => !contentReference.CompareToIgnoreWorkID(EntryRoot))) { contentReference.ProviderName = ProviderKey; } return FilterByCategory(descendents); }
/// <summary> /// The resolve content. /// </summary> /// <param name="contentLink"> /// The content link. /// </param> /// <returns> /// The <see cref="ContentResolveResult"/>. /// </returns> /// <remarks> /// This method should be implemented to support permanent link support. With permanent link means that a link to a /// <see cref="T:EPiServer.Core.IContent"/> /// instance /// can be stored in a Guid based format. Then the link is not broken even if content instance moves. Also permanent links are preserved during import/export and /// mirroring. /// </remarks> protected override ContentResolveResult ResolveContent(ContentReference contentLink) { if (ContentReference.IsNullOrEmpty(contentLink)) { return null; } ContentCoreData contentData = this.ContentCoreDataLoader.Service.Load(contentLink.ID); // All pages but the entry root should appear to come from this content provider if (!contentLink.CompareToIgnoreWorkID(this.EntryRoot)) { contentData.ContentReference.ProviderName = this.ProviderKey; } ContentResolveResult result = this.CreateContentResolveResult(contentData); if (!result.ContentLink.CompareToIgnoreWorkID(this.EntryRoot)) { result.ContentLink.ProviderName = this.ProviderKey; } return result; }
/// <summary> /// The load children references. /// </summary> /// <param name="contentLink"> /// The content link. /// </param> /// <param name="languageID"> /// The language id. /// </param> /// <param name="languageSpecific"> /// The language specific. /// </param> /// <returns> /// An <see cref="IList{ContentReference}"/> of children. /// </returns> /// <remarks> /// If the provider supports structure this method should be implemented. /// </remarks> protected override IList<ContentReference> LoadChildrenReferences( ContentReference contentLink, string languageID, out bool languageSpecific) { if (ContentReference.IsNullOrEmpty(contentLink)) { languageSpecific = false; return new List<ContentReference>(); } // If retrieving children for the entry point, we retrieve pages from the clone root contentLink = contentLink.CompareToIgnoreWorkID(this.EntryRoot) ? this.CloneRoot : contentLink; FilterSortOrder sortOrder; IList<ContentReference> children = this.ContentStore.LoadChildrenReferences( contentLink.ID, languageID, out sortOrder); languageSpecific = sortOrder == FilterSortOrder.Alphabetical; foreach (ContentReference contentReference in children.Where(contentReference => !contentReference.CompareToIgnoreWorkID(this.EntryRoot))) { contentReference.ProviderName = this.ProviderKey; } return this.FilterByCategory(children); }
/// <summary> /// The construct content uri. /// </summary> /// <param name="contentTypeId"> /// The content type id. /// </param> /// <param name="contentLink"> /// The content link. /// </param> /// <param name="contentGuid"> /// The content guid. /// </param> /// <returns> /// The <see cref="Uri"/> of the content. /// </returns> /// <exception cref="System.ArgumentNullException"> /// contentLink /// </exception> protected override Uri ConstructContentUri(int contentTypeId, ContentReference contentLink, Guid contentGuid) { if (ContentReference.IsNullOrEmpty(contentLink)) { throw new ArgumentNullException("contentLink"); } if (!contentLink.CompareToIgnoreWorkID(this.EntryRoot)) { contentLink.ProviderName = this.ProviderKey; } return base.ConstructContentUri(contentTypeId, contentLink, contentGuid); }
/// <summary> /// The get descendent references. /// </summary> /// <param name="contentLink"> /// The content link. /// </param> /// <returns> /// A <see cref="IList{ContentReference}"/> of descendents. /// </returns> public override IList<ContentReference> GetDescendentReferences(ContentReference contentLink) { if (ContentReference.IsNullOrEmpty(contentLink)) { return new List<ContentReference>(); } // If retrieving children for the entry point, we retrieve pages from the clone root contentLink = contentLink.CompareToIgnoreWorkID(this.EntryRoot) ? this.CloneRoot : contentLink; IList<ContentReference> descendents = this.ContentStore.ListAll(contentLink); foreach (ContentReference contentReference in descendents.Where(contentReference => !contentReference.CompareToIgnoreWorkID(this.EntryRoot))) { contentReference.ProviderName = this.ProviderKey; } return this.FilterByCategory(descendents); }