New in 1.20.0

configureObjClassForContentType(mapping)

Defines which CMS object class to use if content is uploaded.

Provides a mapping that consists of key-value pairs where each pair is made up of a file type pattern as the key and a CMS object class name as the value. When looking up the CMS object class to use for the uploaded data, the most specific match will be used.

If no mapping is configured, a default is used instead.

Params

  • mapping (Object) – A mapping from the file type pattern to a CMS object class name. A file type pattern may include either a single wildcard for the subtype part (e.g. image/*), or be the fallback pattern, */*.

Throws

  • ArgumentError if he mapping is erroneous.
  • ScrivitoError if the mapping is configured more than once.

Remarks

This configuration can be defined only once.

The mapping must include an entry for the fallback pattern */*.
The file type pattern does not support prefix matches such as audio/mp*.

Examples

Define specific CMS object classes for audio files:

Override factory defaults: