Studio Developer Manual / Version 2204
Table Of ContentsThe CoreMedia document 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 document types mainly designed to manage technical metadata, such as site settings. In many cases you want to hide these document 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 document type selector in the Library's create content menu, and from the dropdown used to restrict search results to certain document 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 document 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 document types
This call gets the array of excluded document types and adds Strings containing the names of the document 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 document types in TypeScript