Enonic version: currrent
OS: macOS
I extended the graphQL API to query the menu using lib-menu (based on this post Lib-menu headless)
I ended up with the following code:
const schema = guillotineLib.createSchema({
creationCallbacks: {
'portal_Site': function (context, params) {
params.fields.getMenuItems = {
type: libGraphQL.Json,
resolve: function (env) {
return libMenu.getMenuTree(2);
}
};
params.fields.getSubMenu = {
type: libGraphQL.Json,
resolve: function (env) {
//log.info("envelope in callback %s", JSON.stringify(env, null, 2));
return libMenu.getSubMenus(libContent.get({key: 'f0a0690c-c4b0-46d1-af5e-3970b0284a90'}), 1)
}
}
}
}
});
How can I pass arguments, like in get(key:ID)
?? In the code above I would like to get level foe getMenuItems
and the content-id
for getSubMenu!
How I can more information about extending the Guillotine-API?