System Information
- Strapi Version: 4.10.5
- Operating System: Windows 11
- Database: SQLite
- Node Version: 16.18.1
- NPM Version: 8.19.2
- Yarn Version:
I want to create a content type that has a banner component and a relation to another table.
I’m trying to do this in my plugin’s bootstrap function.
This is my code so far:
try {
const parentMenuType = await strapi.plugin('content-type-builder').services['content-types'].createContentType({
contentType: parentMenu,
components: [
{
category: 'menu',
displayName: banner.info.displayName,
attributes: banner.attributes,
},
{
category: 'menu',
displayName: children.info.displayName,
attributes: children.info.attributes,
}
]
});
console.log('parentMenuType', JSON.stringify(parentMenuType));
} catch (e) {
console.log("ERROR \n", e);
}
parentMenu, banner, children are JSON schemas.