Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strapi Hide Content Type

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.

like image 245
BROCHOT Thomas Avatar asked Oct 16 '25 16:10

BROCHOT Thomas


2 Answers

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
    },
    
  }

}
like image 62
Arshad KM Avatar answered Oct 19 '25 13:10

Arshad KM


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.

  1. Copy file strapi-plugin-content-manager/services/data-mapper.js from your app node_modules into extensions/content-manager/services/

  2. 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',
];

...

like image 36
VRGZ Avatar answered Oct 19 '25 15:10

VRGZ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!