close

Filter

loading table of contents...

Studio Developer Manual / Version 2406.0

Table Of Contents

9.5.6 Excluding Content Types from the Library

The CoreMedia content type model is a very powerful concept to tailor CoreMedia CMS to your needs. However, in any typical project, there are at least a couple of content types mainly designed to manage technical metadata, such as site settings. In many cases you want to hide these content types from casual users of CoreMedia Studio, thereby keeping the interface simple and avoiding clutter. To do so, you can remove choices from the dropdown content type selector in the Library's create content menu, and from the dropdown used to restrict search results to certain content types.

You can add the content types that should not be shown to the list of excluded content types using the @coremedia/studio-client.main.editor-components/sdk/editorContext. The methods getExcludedDocumentTypes() and getContentTypesExcludedFromSearch() return an array holding the names of all content types excluded from the create content dropdown and search filter dropdown, respectively. Using the array's push method, you can add additional content types you wish to hide: editorContext._.getExcludedDocumentTypes().push('<DocType1>', ...)

editorContext._.getExcludedDocumentTypes().push('Dictionary',
  'Preferences', 'Query',
  'CMDynamicList', 'CMVisual',
  'EditorPreferences');

Example 9.26. Defining excluded content types


This call gets the array of excluded content types and adds Strings containing the names of the content types to exclude.

You can also use the ConfigureDocumentTypes plugin from the previous section to achieve the same in a more declarative manner.

import ConfigureDocumentTypes from "@coremedia/studio-client.main.editor-components/configuration/ConfigureDocumentTypes";

//...
new ConfigureDocumentTypes({
        names: "Dictionary,Preferences,Query,CMDynamicList,CMVisual,EditorPreferences",
        exclude: true,
        excludeFromSearch: true,
})

Example 9.27. Defining excluded content types in TypeScript


Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.