use of com.enonic.xp.region.ComponentPath in project xp by enonic.
the class ComponentHandlerWorker method inlineFragments.
private Page inlineFragments(Page page, final ComponentPath componentPath) {
// traverse page based on componentPath, inline fragments components if found
final List<ComponentPath.RegionAndComponent> partialComponentPathParts = new ArrayList<>();
for (ComponentPath.RegionAndComponent pathPart : componentPath) {
partialComponentPathParts.add(pathPart);
final ComponentPath path = new ComponentPath(ImmutableList.copyOf(partialComponentPathParts));
final Component component = page.getRegions().getComponent(path);
if (component == null) {
break;
}
if (component instanceof FragmentComponent) {
final FragmentComponent fragment = (FragmentComponent) component;
final Component fragmentComponent = getFragmentComponent(fragment);
if (fragmentComponent == null) {
break;
}
page = new FragmentPageResolver().inlineFragmentInPage(page, fragmentComponent, path);
}
}
return page;
}
Aggregations