public Page.Elements.PageComposition CreatePageComposition(CmsPage cmsPage) { var pageBuilder = new PageComposerTools(_cmsPageContentActivator); var page = new Page.Elements.PageComposition(); page.RootElement = new UndefinedLayoutPageCompositionElement(); if (cmsPage.LayoutId != Guid.Empty) { var layoutRepository = new LayoutRepository(); var layoutToApply = layoutRepository.GetById(cmsPage.LayoutId); pageBuilder.AddLayoutContent(page, GetLayoutStructure(layoutToApply)); } var pageSpecificContent = cmsPage.PageContent; var d = page.GetPartialPageRenderingByLayoutBuilderId(); foreach (var contentItem in pageSpecificContent) { var placementLayoutBuilderId = contentItem.PlacementLayoutBuilderId ?? SpecialRenderingFragmentContentIds.PageRoot; var root = d[placementLayoutBuilderId]; var presentationElement = contentItem.ToPresentationElement(); pageBuilder.AddAdHocContent(presentationElement, root); } return(page); }
public void AddLayoutContent(Page.Elements.PageComposition page, PageLayout layoutToApply) { if (layoutToApply.ParentLayout != null) { AddLayoutContent(page, layoutToApply.ParentLayout); } if (!string.IsNullOrWhiteSpace(layoutToApply.MasterPagePath)) { page.RootElement = _contentActivator.ActivateRootLayout(layoutToApply.MasterPagePath); } AddLayoutContent(layoutToApply.AllContent, page.RootElement); }
public RenderingFragmentCollection Execute(Page.Elements.PageComposition pageRendering, FragmentRenderMode renderMode) { var transformationResult = new RenderingFragmentCollection(); var cached = new CachedContentFragmentRenderer().Execute(pageRendering.RootElement); transformationResult.Add(cached); foreach (var engine in _engines) { var localBatch = engine.Execute(pageRendering.RootElement); transformationResult.Add(localBatch); } return(transformationResult); }