Collection Schema
A collection schema is a JSON array of objects, where each object defines a property of that collection. For example, the schema of a simple blog post with a title and content might look like this:
[
{
"name": "title",
"label": "title",
"casts": "string",
"controltype": "text",
"required": true,
"value": ""
},
{
"name": "content",
"label": "Content",
"casts": "string",
"controltype": "htmleditor",
"validation": "min:10",
"value": ""
}
]
Defining Collection Properties
The following attributes can be used to define a collection property:
name |
required - the field name |
label |
optional - default is nicely formated version of the field name |
casts |
optional - default is string |
controltype |
optional - default is text input |
validation |
validation rules for this input |
required |
whether or not a value is required (default is false) |
value |
the default value |
Some controls types have additional properties. For example, the asset_selector will accept a "type" attribute, and the radio_stack needs an "options" attribute which is an array of options (values).
Control Types
The following control types are available:
Control Type |
Additional Param |
Description |
asset_collection |
type |
widget for selecting and managing a list of one or more assets |
asset_selector |
type |
widget for selecting an asset. If the type parameter is specified, then only assets of that type can be picked |
category_select |
-- |
widget for selecting a category |
datetime |
-- |
date and time picker |
default |
-- |
default (text) |
html |
-- |
html code |
htmleditor |
-- |
wysiwyg html editor |
image |
-- |
image picker |
image_collection |
-- |
select one or more images |
instructions |
-- |
text to be displayed as instructional text |
markdown |
-- |
markdown editor |
number |
-- |
number input |
page_select |
-- |
select a page |
page_selector |
-- |
select one or more pages |
post_collection |
-- |
select one or more posts |
post_selector |
-- |
select a post |
radiostack |
options (arr) |
stack of radio buttons |
raw_html |
-- |
textarea |
rect-list |
-- |
-- |
richtext |
-- |
alias of richtexteditor |
richtexteditor |
-- |
simplified html editor for writing priose |
select-template |
-- |
select a template |
select |
options |
select / dropdown |
text |
-- |
simple text input |
textarea |
-- |
simple textarea |
thumbnail |
-- |
thumbnail picker |
video |
-- |
-- |
yesno |
-- |
-- |