Collections

There are two primary aspects to setting up a collection:

  1. creating a schema - which defines what properties each item (post) in the collection will have; and 
  2. define a configuration - which determines how the collection should be managed by textsem

 

 

Collection Schema

The collection schema is a specal JSON file that defines the structure of the items in a collection. This is usually setup by a developer when building a site, but they can also be added and updated in Textstem.

[
    {
        "name": "title",
        "label": "title",
        "casts": "string",
        "controltype": "text",
        "required": true,
        "value": ""
    },
    {
        "name": "author",
        "label": "author",
        "casts": "string",
        "controltype": "text",
        "required": false,
        "value": ""
    },
    {
        "name": "content",
        "label": "Content",
        "casts": "string",
        "controltype": "htmleditor",
        "required": false,
        "value": ""
    }
]

Each entry in the schema can specify the following:

name

The attribute name

label

How the attribute is displayed in the Admin interface

controltype

The control type used to enter or select the value (default is a text input)

casts

cast the value. This can be any of the Textstem types such as integer, float, date, datetime, boolean and string (default)

required

If the value is required

Configuring Collections

In addition to specifying a schema, collections can be configured to have specific list views, widgets and columns in the admin views.