Skip to main content
Module

x/netlify_cms_config/mod.ts>Relation

Netlify CMS config generator
Latest
class Relation
extends Field<Options>
Re-export
import { Relation } from "https://deno.land/x/netlify_cms_config@v0.3.2/mod.ts";

Constructors

new
Relation(label: string, config?: Options)

Properties

widget: string

Methods

collection(value: string): this

Name of the referenced collection

default(value: string): this

Accepts any widget data type; defaults to an empty string

displayFields(value: string[]): this

List of one or more names of fields in the referenced collection that will render in the autocomplete menu of the control. Defaults to value_field. Syntax to reference nested fields is similar to that of value_field.

file(value: string): this

Allows referencing a specific file when the referenced collection is a files collection (string)

max(value: number): this

Maximum number of items. Ignored if multiple is false

min(value: number): this

Minimum number of items. Ignored if multiple is false

multiple(value?): this

Accepts a boolean, defaults to false

optionsLength(value: number): this

Accepts integer to override number of options presented to user. Defaults to 20.

searchFields(value: string[]): this

List of one or more names of fields in the referenced collection to search for the typed value. Syntax to reference nested fields is similar to that of value_field.

target(
collection: File | Folder,
valueField: string,
searchFields?: string[],
): this

Relate automatically with a folder/file collection

valueField(value: string): this

Name of the field from the referenced collection whose value will be stored for the relation. For nested fields, separate each subfield with a . (e.g. name.first). For list fields use a wildcard * to target all list items (e.g. categories.*).

Static Properties

defaults: Options