I've search for several hours how to hide a specific content type.
I found some post but they are too older and their solutions doesn't work in the actual's strapi.
For precisions, my collection type is declared inside a local plugin. I juste want to manage my collection inside the plugin page and I doesn't want it appear in the content type in the left menu.
If someone has a solution, it's can be really helpfull.
In new version of Strapi v3.6.6 — Community Edition there is an option in model
{
"kind": "collectionType",
"collectionName": "test",
"info": {
"name": "test"
},
"options": {
"increments": true,
"timestamps": true,
"draftAndPublish": true
},
**"pluginOptions": {
"content-manager": {
"visible": false
}
},**
"attributes": {
"name": {
"type": "string",
"required": true
},
}
}
They are working on this: https://github.com/strapi/rfcs/pull/22
But for now, based on official docs ( plugin customization ), you can overwrite file in content-manager plugin.
Be sure to check this file on strapi updates to avoid overwriting important code.
Copy file strapi-plugin-content-manager/services/data-mapper.js
from your app node_modules into extensions/content-manager/services/
Now edit this file in your project and add your content type to array HIDDEN_CONTENT_TYPES
following this pattern: plugins::[plugin-name].[content-type]
For example: plugins::ecommerce.product
...
const HIDDEN_CONTENT_TYPES = [
'plugins::upload.file',
'plugins::users-permissions.permission',
'plugins::users-permissions.role',
'plugins::ecommerce.product',
];
...
You can extend the plugin to make updates to the content-type's schema.
Copy the content-type schema from the plugin to your src folder.
In my case, I copied /strapi-plugin-navigation/server/content-types/audience/schema.json
to /src/extensions/navigation/content-types/audience/schema.json
(notice that the strapi-plugin-
part of the folder name is removed) and added the following to it to hide the "Audience" content type from the content manager and content-type builder:
"pluginOptions": {
"content-manager": {
"visible": false
},
"content-type-builder": {
"visible": false
}
},
Official documentation here .
In Strapi v4 it is "visible": false
{
"kind": "collectionType",
"collectionName": "bookmark",
"info": {
"singularName": "bookmark",
"pluralName": "bookmarks",
"displayName": "Bookmark",
"description": ""
},
"options": {
"increments": true,
"timestamps": true,
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"index": {
"type": "integer",
"unique": false,
"visible": false
},
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.