Hi community, Hi Tom
Why the ittem array of a joinByOne’s apostrophe-page does not contain it’s children?
What i got is this widget:
module.exports = {
extend: 'apostrophe-widgets',
label: 'Interner Link',
addFields: [
{
name: '_page',
type: 'joinByOne',
withType: 'apostrophe-page',
label: 'Page',
idField: 'pageId'
}
]
};
I have to display all children (1st level) underneath it.
I store the page-link in my global scope invisible:
{{
apos.singleton(data.global, 'applicationpage', 'adt-innerlink-li', {
visible: false
})
}}
Just to get it for a link list:
{% for tab in data.global.applicationpage.items.pop()._page._children %}
<li><a href="{{ tab._url }}">{{ tab.title }}</a></li>
{% endfor %}
But even when the page object has children, the data.global.applicationpage items does not.
I loged data.global.applicationpage:
{ type: 'area',
items:
[ { _id: 'w835494927120381536',
pageId: 'citfnn3aq00033gbj6v4yc5ee',
type: 'adt-innerlink-li',
_edit: true,
_page: [Object] } ],
_edit: true,
_docId: 'citfllqhl0005tnbjpq9cw3ak',
_dotPath: 'applicationpage’ }
and diged into item_page: ( data.global.applicationpage.items[0]._page )
{ _id: 'citfnn3aq00033gbj6v4yc5ee',
published: true,
loginRequired: '',
trash: false,
type: 'default',
title: 'Anwendungen',
slug: '/anwendungen',
tags: [],
orphan: false,
viewUsersIds: [],
viewGroupsIds: [],
editUsersIds: [],
editGroupsIds: [],
rank: 1,
path: '/anwendungen',
level: 1,
createdAt: Fri Sep 23 2016 12:59:02 GMT+0200 (CEST),
titleSortified: 'anwendungen',
updatedAt: Fri Sep 23 2016 12:59:02 GMT+0200 (CEST),
highSearchText: 'anwendungen anwendungen',
highSearchWords: [ 'anwendungen' ],
lowSearchText: 'anwendungen anwendungen',
searchSummary: '',
docPermissions: [],
_edit: true,
_publish: true,
_url: '/anwendungen’ }
no _children array exists.
When I log
data.page on this page it has children:
{ _id: 'citfnn3aq00033gbj6v4yc5ee',
published: true,
loginRequired: '',
trash: false,
type: 'default',
title: 'Anwendungen',
slug: '/anwendungen',
tags: [],
orphan: false,
viewUsersIds: [],
viewGroupsIds: [],
editUsersIds: [],
editGroupsIds: [],
rank: 1,
path: '/anwendungen',
level: 1,
createdAt: Fri Sep 23 2016 12:59:02 GMT+0200 (CEST),
titleSortified: 'anwendungen',
updatedAt: Fri Sep 23 2016 12:59:02 GMT+0200 (CEST),
highSearchText: 'anwendungen anwendungen',
highSearchWords: [ 'anwendungen' ],
lowSearchText: 'anwendungen anwendungen',
searchSummary: '',
docPermissions: [],
_edit: true,
_publish: true,
_url: '/anwendungen',
_ancestors:
[ { ... } ],
_children:
[ { _id: 'citfp16td0003i5bjhh6r9we7',
published: true,
loginRequired: '',
trash: false,
type: 'default',
title: 'Inspector Json',
slug: '/anwendungen/inspector-json',
viewUsersIds: [],
viewGroupsIds: [],
editUsersIds: [],
editGroupsIds: [],
tags: [],
orphan: false,
rank: 0,
path: '/anwendungen/inspector-json',
level: 2,
createdAt: Fri Sep 23 2016 13:38:00 GMT+0200 (CEST),
titleSortified: 'inspector json',
updatedAt: Fri Sep 23 2016 13:38:00 GMT+0200 (CEST),
highSearchText: 'inspector json anwendungen inspector json',
highSearchWords: [Object],
lowSearchText: 'inspector json anwendungen inspector json',
searchSummary: '',
docPermissions: [],
_edit: true,
_publish: true,
_url: '/anwendungen/inspector-json',
_children: [] } ] }
Does anyone know how to geht the children with a joinByOne’s apostrophe-page? Or how to load the page by it’s id that I can get the children's attributes?
Thanks a lot,
ps