Search in sources :

Example 1 with PageTemplateKey

use of com.enonic.xp.page.PageTemplateKey in project xp by enonic.

the class PageResolver method mergePageFromPageTemplate.

private static Page mergePageFromPageTemplate(final PageTemplate pageTemplate, final Page page) {
    final Page templatePage = pageTemplate.getPage();
    final PageTemplateKey templateKey = pageTemplate.getKey();
    if (templatePage != null) {
        final Page.Builder pageBuilder = Page.create(templatePage).descriptor(null).template(templateKey);
        if (page != null) {
            if (page.getConfig() != null) {
                pageBuilder.config(page.getConfig());
            }
            if (page.getRegions() != null) {
                pageBuilder.regions(page.getRegions());
            }
        }
        return pageBuilder.build();
    } else {
        return page != null ? page : Page.create().template(templateKey).build();
    }
}
Also used : Page(com.enonic.xp.page.Page) PageTemplateKey(com.enonic.xp.page.PageTemplateKey)

Aggregations

Page (com.enonic.xp.page.Page)1 PageTemplateKey (com.enonic.xp.page.PageTemplateKey)1