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();
}
}
Aggregations