Open sigdestad opened 4 years ago
Page is only a component for the serialization. Everywhere inside XP and at application level, the structure is exactly the same as 6.15.
I am closing this issue as this is not a bug but a much bigger refactoring
Glenn, I don't know what this looks like on Java level, but why does returning the basic component info require refactoring?
Because Page is not a component. It is serialized as one but it has never been a component I think
But we are takling about returning a serialized object here
React4xp uses the page component in order to make some smart choices for rendering. Documentation and examples uses getComponent in the page controller.
There are also documentation and examples from other apps, that uses getComponent in page.
@sigdestad want's this fixed in Enonic XP 8
The Component type should include page, text, fragment (and maybe macro?) https://github.com/enonic/xp/blob/master/modules/lib/core/index.d.ts#L59
Reopening for discussion
The result of a method call from page controller should look like
var expected = {
"path": "/",
"type": "page",
"descriptor": "myapplication:myPage",
"config": {
"a": "1"
},
"regions": {
"bottom": {
"components": [
{
"path": "/main/0",
"type": "part",
"descriptor": "myapplication:mypart",
"config": {
"a": "1"
}
}
],
"name": "bottom"
}
}
};
There is a full type declaration for PageComponent here: https://github.com/enonic/xp/blob/master/modules/lib/core/index.d.ts
As of xp7, a page is a component, conceptually like any other. Make sure this function returns the page component definition, juse like it does for parts and layouts.