Skip to content

Configuration reference ​

Every setting of the Field Item Relationship fieldtype (type: field_item_relationship), in the order the blueprint editor shows them. Common Statamic field settings (display, instructions, localizable, validate, if…) work as usual.

The Selection section of the field settings: Allow multiple, Max items, Input type, Columns, Aspect ratio, Show labelsThe Selection section of the field settings: Allow multiple, Max items, Input type, Columns, Aspect ratio, Show labels

The Selection section of the field settings.

Source ​

SettingYAML keyTypeDefaultShown when
Source typesource_typesibling_or_ancestor | globalsibling_or_ancestoralways
Source global setsource_global_setglobal set handlenonesource_type is global
Source fieldsource_fieldfield handlenonealways

Source type: where the source field is. Sibling or ancestor looks in the same blueprint, starting with the field's own Grid row or Replicator set and walking up to the top level. Global reads a field of a Global set. See Sources.

Source global set: the global set that holds the source field. Older configs that use the key source_global are still read.

Source field: the handle of the field to take items from. Any field that stores a list or a keyed object: List, Grid, Replicator, Assets, Array, Checkboxes…

Options ​

SettingYAML keyTypeDefaultShown when
Option label sourceoption_label_sourcekey, dot path or `template`nonealways
Option image sourceoption_image_sourcekey / dot pathnonealways
Save assave_askey | value | index | id | object_key | objectnone (required)always
Object keyobject_keykey / dot pathnonesave_as is object_key or object

Option label source: for object items, the key to use as the option label. Dot notation works for nested keys. For advanced labels, use a string literal in back ticks, where o is the item: `${o.name} (${o.role})`.

Option image source: for object items (Grid rows, Replicator sets) that contain an Assets field, that field's handle. It is used for thumbnails in the image grid and the dropdown. Not needed when the source itself is an Assets field.

Save as: what is stored when an item is picked. The allowed modes depend on the source data, see Save as modes. For Assets sources, use value (the asset ID).

Object key: the key that object_key saves, and that object uses to find the row again.

Selection ​

SettingYAML keyTypeDefaultShown when
Allow multiplemultiplebooleanfalsealways
Max itemsmax_itemsinteger ≥ 1none (no limit)multiple is true
Input typeinput_typeselect | radio | button_group | image_gridselectalways
Inlineinlinebooleanfalseinput_type is radio
Columnscolumnsinteger ≥ 14input_type is image_grid
Aspect ratioaspect_ratio1/1 | 4/3 | 3/2 | 16/9 | 3/44/3input_type is image_grid
Show labelsshow_labelsbooleantrueinput_type is image_grid

Allow multiple: allow selecting more than one item. The value is saved as a list.

Max items: the maximum number of items that can be selected.

Input type: how the options are presented. Radio buttons become checkboxes when multiple selections are allowed. The image grid shows thumbnails for Assets sources, or when an option image source is set. See Input types.

Inline: show the radio buttons or checkboxes next to each other.

Columns, Aspect ratio, Show labels: image grid layout. Show labels shows the option label (or file name) under each image.

Complete example ​

A field with every option set (values from the testbench demos):

yaml
- handle: office
  field:
    type: field_item_relationship
    display: Office
    instructions: Where does this person work?
    localizable: true

    # Source
    source_type: global
    source_global_set: demo_settings
    source_field: offices

    # Options
    option_label_source: '`${o.city}, ${o.country}`'
    option_image_source: photo
    save_as: object_key
    object_key: city

    # Selection
    multiple: false
    input_type: image_grid
    columns: 3
    aspect_ratio: 3/2
    show_labels: true

Saved values ​

ConfigurationStored in the content file
singlea scalar (or an object for save_as: object)
multiple: truea list

An empty selection is saved as null, not as an empty string or an empty list.

Released under the MIT License. Made with fruit by kiwikiwi