Skip to main content

The composed field type contains the data that the composer editor defines. It is an array of objects which expose type and value properties. The type property is a name given to an allowed field type validation defined in the content type that the entry is based on. The value contains the data for the field.

An allowed field type is essentially any standard field (such as Image, Heading, Location, etc.) that restricts what types of field can be added to a composed field.

For example, an allowed field could be defined with a type of Heading and named mainHeading or with a type of Image and named bannerImage. There can be multiple allowed fields based on the same type, but a composed field cannot contain other composed fields.

Properties

Name Type Format Description
type string   The field name given to a field type defined in the content type
value Any Any The value of the field, which can be of any type

Example

Getting a composed field called "myComposedField" from an entry:

JavaScript
ContensisClient.entries.get('<entry_id>').then(function (entry) {
    entry.myComposedField.map((field) => {
        switch (field.type) {
            case 'heading':
                return (
                    console.log(field.value)
                );
            case 'markup':
                return (
                    console.log(field.value)
                );
            case 'image':
                return (
                    console.log(field.value.asset.sys.uri, field.value.altText)
                );
            case 'quote':
                return (
                    console.log(field.value.text, field.value.source)
                );
            default:
                break;
        }
        return null
    });
});

Still need help?

If you still need help after reading this article, don't hesitate to reach out to the Contensis community on Slack or raise a support ticket to get help from our team.
New support request