public static Dynamic.Page BuildPage(TCM.Page tcmPage, Engine engine, BuildManager manager, int linkLevels, bool resolveWidthAndHeight, bool publishEmptyFields) { Dynamic.Page p = new Dynamic.Page { Title = tcmPage.Title, Id = tcmPage.Id.ToString(), Filename = tcmPage.FileName, PageTemplate = manager.BuildPageTemplate(tcmPage.PageTemplate), Schema = manager.BuildSchema(tcmPage.MetadataSchema), Version = tcmPage.Version, RevisionDate = tcmPage.RevisionDate, MetadataFields = new Dynamic.FieldSet() }; if (linkLevels > 0) { try { if (tcmPage.Metadata != null && tcmPage.MetadataSchema != null) { var tcmMetadataFields = new Tridion.ContentManager.ContentManagement.Fields.ItemFields(tcmPage.Metadata, tcmPage.MetadataSchema); p.MetadataFields = manager.BuildFields(tcmMetadataFields); } } catch (Exception) { // fail silently if there is no metadata schema } } p.ComponentPresentations = new List <Dynamic.ComponentPresentation>(); foreach (TCM.ComponentPresentation cp in tcmPage.ComponentPresentations) { Dynamic.ComponentPresentation dynCp = manager.BuildComponentPresentation(cp, engine, linkLevels - 1, resolveWidthAndHeight); p.ComponentPresentations.Add(dynCp); } p.StructureGroup = manager.BuildOrganizationalItem((TCM.StructureGroup)tcmPage.OrganizationalItem); if (!manager.BuildProperties.OmitContextPublications) { p.Publication = manager.BuildPublication(tcmPage.ContextRepository); } if (!manager.BuildProperties.OmitOwningPublications) { p.OwningPublication = manager.BuildPublication(tcmPage.OwningRepository); } if (!manager.BuildProperties.OmitCategories) { p.Categories = manager.BuildCategories(tcmPage); } manager.AddXpathToFields(p.MetadataFields, "Metadata"); return(p); }
public static Dynamic.Page BuildPage(TCM.Page tcmPage, Engine engine, BuildManager manager, int linkLevels, bool resolveWidthAndHeight,bool publishEmptyFields) { Dynamic.Page p = new Dynamic.Page { Title = tcmPage.Title, Id = tcmPage.Id.ToString(), Filename = tcmPage.FileName, PageTemplate = manager.BuildPageTemplate(tcmPage.PageTemplate), Schema = manager.BuildSchema(tcmPage.MetadataSchema), Version = tcmPage.Version, RevisionDate = tcmPage.RevisionDate, MetadataFields = new Dynamic.FieldSet() }; if (linkLevels > 0) { try { if (tcmPage.Metadata != null && tcmPage.MetadataSchema != null) { var tcmMetadataFields = new Tridion.ContentManager.ContentManagement.Fields.ItemFields(tcmPage.Metadata, tcmPage.MetadataSchema); p.MetadataFields = manager.BuildFields(tcmMetadataFields); } } catch (Exception) { // fail silently if there is no metadata schema } } p.ComponentPresentations = new List<Dynamic.ComponentPresentation>(); foreach (TCM.ComponentPresentation cp in tcmPage.ComponentPresentations) { Dynamic.ComponentPresentation dynCp = manager.BuildComponentPresentation(cp, engine, linkLevels - 1, resolveWidthAndHeight); p.ComponentPresentations.Add(dynCp); } p.StructureGroup = manager.BuildOrganizationalItem((TCM.StructureGroup)tcmPage.OrganizationalItem); if (!manager.BuildProperties.OmitContextPublications) { p.Publication = manager.BuildPublication(tcmPage.ContextRepository); } if (!manager.BuildProperties.OmitOwningPublications) { p.OwningPublication = manager.BuildPublication(tcmPage.OwningRepository); } if (!manager.BuildProperties.OmitCategories) { p.Categories = manager.BuildCategories(tcmPage); } manager.AddXpathToFields(p.MetadataFields, "Metadata"); return p; }