BuildPageTemplate() публичный Метод

public BuildPageTemplate ( Tridion.ContentManager.CommunicationManagement tcmPageTemplate ) : Tridion.Extensions.DynamicDelivery.ContentModel.PageTemplate
tcmPageTemplate Tridion.ContentManager.CommunicationManagement
Результат Tridion.Extensions.DynamicDelivery.ContentModel.PageTemplate
Пример #1
0
        public static Dynamic.Page BuildPage(TCM.Page tcmPage, Engine engine, BuildManager manager, int linkLevels, bool resolveWidthAndHeight)
        {
            Dynamic.Page p = new Dynamic.Page();
            p.Title = tcmPage.Title;
            p.Id = tcmPage.Id.ToString();
            p.Filename = tcmPage.FileName;
            p.PageTemplate = manager.BuildPageTemplate(tcmPage.PageTemplate);
            p.Schema = manager.BuildSchema(tcmPage.MetadataSchema);
            p.Metadata = new Dynamic.SerializableDictionary<string, Dynamic.Field>();
            if (linkLevels > 0) {
                try {
                    if (tcmPage.Metadata != null) {
                        var tcmMetadataFields = new Tridion.ContentManager.ContentManagement.Fields.ItemFields(tcmPage.Metadata, tcmPage.MetadataSchema);
                        p.Metadata = manager.BuildFields(tcmMetadataFields, linkLevels, resolveWidthAndHeight);
                    }
                } catch (ItemDoesNotExistException) {
                    // 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);
            p.Publication = manager.BuildPublication(tcmPage.ContextRepository);
            p.Categories = manager.BuildCategories(tcmPage);

            return p;
        }
        public static Dynamic.Page BuildPage(TCM.Page tcmPage, Engine engine, BuildManager manager, int linkLevels, bool resolveWidthAndHeight)
        {
            Dynamic.Page p = new Dynamic.Page();
            p.Title        = tcmPage.Title;
            p.Id           = tcmPage.Id.ToString();
            p.Filename     = tcmPage.FileName;
            p.PageTemplate = manager.BuildPageTemplate(tcmPage.PageTemplate);
            p.Schema       = manager.BuildSchema(tcmPage.MetadataSchema);
            p.Metadata     = new Dynamic.SerializableDictionary <string, Dynamic.Field>();
            if (linkLevels > 0)
            {
                try {
                    if (tcmPage.Metadata != null)
                    {
                        var tcmMetadataFields = new Tridion.ContentManager.ContentManagement.Fields.ItemFields(tcmPage.Metadata, tcmPage.MetadataSchema);
                        p.Metadata = manager.BuildFields(tcmMetadataFields, linkLevels, resolveWidthAndHeight);
                    }
                } catch (ItemDoesNotExistException) {
                    // 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);
            p.Publication    = manager.BuildPublication(tcmPage.ContextRepository);
            p.Categories     = manager.BuildCategories(tcmPage);

            return(p);
        }