/field/
Description
Fields are the mobo equivalent to SMW attributes.
The biggest difference to SMW attributes is that mobo fields already declare how they are rendered and validated. Those information are inherited through the models up to the final form.
Fields declare
- A human readable title
- An optional description
- The datatype, consisting of type and format (see JSON Schema Spec)
- Whether the field links to forms
- Additional validation (some datatypes already come with validation)
- Semantic Forms options that define how the field will render and behave in Semantic Forms
Available Properties
ID | Description |
---|---|
$abstract | If true this object is only used for inheritance and will not be created by itself. Type(s): boolean Specific to: intermediary Default: false Example:
|
$extend | This includes and extends another file of the development. Type(s): arraystring Specific to: intermediary Example:
Example:
Example:
|
$ignore | If true, this file will be ignored completely. Type(s): boolean Specific to: intermediary Default: false Example:
|
$remove | Array, containing the IDs of all items/properties to remove from current object. Type(s): array Specific to: intermediary Example:
|
default | The default value. Applies only to fields. Specific to: domain |
deprecated | If true, the field will be marked as deprecated. It will not be displayed in forms, but the template will keep it in order to display old entries. Type(s): boolean Specific to: domain Default: false Example:
|
description | General Description. Fields may use them as tooltips, forms can display a small description box. This depends on the used template. Type(s): string Specific to: domain Example:
|
enum | List of all possible values. Type(s): array Specific to: domain Example:
|
form | Defines which form should be automatically used if the red link is clicked.
It can link to one multiple forms. Type(s): arraystring Specific to: domain Example:
Example:
|
format | Describes the semantic format (how to interpret the type). E.g. 'email' or SMW specific datatypes like 'Temperature' Type(s): string Specific to: domain Valid entries: date, date-time, url, email, tel, Page, page, Code, code, geographic coordinate, Geographic coordinate, Quantity, quantity, Record, record, Temperature, temperature Example:
|
items | Some fields have multiple values (e.g. comma seperated). Type(s): arrayobject Specific to: domain Default: {} Example:
|
itemsOrder | In case that fields have been inherited, they might not end up in the correct order. Type(s): array Specific to: domain Example:
Example:
|
maxItems | How many instances are allowed at most. Type(s): number Specific to: domain Unsupported: This property is currently unsupported by the end-system. |
maxLength | The maximum length of a string. Type(s): number Specific to: domain Unsupported: This property is currently unsupported by the end-system. |
maximum | The maximum value of a number. Type(s): number Specific to: domain Unsupported: This property is currently unsupported by the end-system. |
minItems | How many instances are required at least. Type(s): number Specific to: domain Unsupported: This property is currently unsupported by the end-system. |
minLength | The minimum length of a string. Type(s): number Specific to: domain Unsupported: This property is currently unsupported by the end-system. |
minimum | The minimum value of a number. Type(s): number Specific to: domain Unsupported: This property is currently unsupported by the end-system. |
pattern | Provides a Regular Expression (Regex) pattern to validate the field value. Type(s): string Specific to: domain Unsupported: This property is currently unsupported by the end-system. Example:
|
sf_form | The sf_form property is an object that redirects all settings directly to Semantic Forms. Type(s): object Specific to: platform External Link: Documentation Example:
|
sf_overwrite | Overwrites the final wikitext/HTML that is rendered in Semantic Forms Edit mode Type(s): string Specific to: implementation |
showForm | Whether to display this element in the form-edit view. Type(s): boolean Specific to: domain Default: true Example:
|
showPage | Whether to display this element in the page view. Type(s): boolean Specific to: domain Default: true Example:
|
smw_appendFormField | Adds wikitext after the form input field. This is only displayed when the form is in edit mode. Type(s): string Specific to: implementation Example:
|
smw_arraymaptemplate | Name of the arraymap template to use. Type(s): string Specific to: platform Default: false External Link: Documentation Example:
|
smw_drilldown | If the global settings `smw_semanticDrilldown` is enabled, fields with smw_drilldown set to true will be filterable. Type(s): boolean Specific to: platform Default: false Example:
|
smw_forceSet | Forces the semantic storage of the attribute through the #set parser function. Type(s): boolean Specific to: platform Default: false Example:
|
smw_overwriteData | Overwrites the final #set or #subobject value of the field. Type(s): string Specific to: implementation |
smw_overwriteDisplay | Overwrites only the display value of the current field Type(s): string Specific to: implementation |
smw_overwriteOutput | Overwrites the final value of the field, used for both display and data set Type(s): string Specific to: implementation Example:
Example:
|
smw_overwriteOutputToLink | If true, this will create a link in display mode, using #formredlink if applicable. Type(s): boolean Specific to: platform Example:
|
smw_property | If smw_property is set to false the templates won't declare it as a semantic property. Please note that the field can't be queried then. Type(s): boolean Specific to: platform Default: true Example:
|
title | Human readable title. Type(s): string Specific to: domain Example:
|
todo | If TODO notes are placed here, mobo can print them in the CLI (If the corresponding global setting is enabled). Type(s): string Specific to: domain |
type | Defines the data-type. Type(s): string Specific to: domain Valid entries: string, number, boolean, array, object Example:
|
Supported Datatypes
Overview
Semantic MediaWiki | mobo |
---|---|
Boolean | type: boolean |
Code | type: string format: Code |
Date | type: string format: date |
type: string format: email |
|
Geographic coordinate | type: string format: Geographic coordinate |
Number | type: number |
Page | type: string format: Page |
Quantity | type: string format: Quantity |
Record | type: string format: Record |
Telephone number | type: string format: tel |
Temperature | type: string format: Temperature |
Text | type: text |
URL | type: string format: url |
Primitive Datatypes (type)
- number / integer
- boolean
- string / text
To define a primitive datatype, just declare the type
:
type: number
Semantic Datatypes (format)
Semantic Datatypes are defined through the format
attribute.
Usually the primitive type
datatype is string
.
- JSON Schema data types
- date / date-time
- url
- tel
- SMW specific data types
- Page
- Code
- Geographic coordinate
- Quantity
- Record
- Temperature
To define a semantic data type, declare the format
in addition to the "type":
type: string
format: date
Linking to Forms (form)
The form
property can be used to reference to a form.
This implicitly sets type
to string
and format
to Page
If the url links to a page that does not exist yet, it will be created through the defined form.
form: Location
It is also possible to link to multiple forms:
form:
- FormA
- FormB
Multiple values
Some fields need to specify multiple values.
In this case the type
needs to be set to array
and the items
property holds the actual type/format/form:
title: Locations
type: array
items:
type: string
form: Location