Getting started
Field Item Relationship adds one fieldtype to Statamic. It does not store content of its own. It points at an item in another field (the source field) and saves a reference to it.
Some typical uses:
- Pick the main image from the entry's own gallery (an Assets field), shown as a thumbnail grid.
- Pick the team lead from a Grid of team members.
- Pick one of the brand colours defined in a List on a Global set.
- Pick the cover of a gallery block inside a Replicator, from that block's own images.
Requirements
| Version | |
|---|---|
| PHP | 8.3 or newer |
| Statamic | 6.0 or newer (6.44+ for the image grid) |
| Statamic version | Add-on version | Branch |
|---|---|---|
| Statamic 3, 4, 5 | 1.x | 1.x |
| Statamic 6 | 2.x | main |
Installation
composer require eminos/statamic-field-item-relationshipThe add-on registers itself, and there is nothing to publish or configure. The fieldtype is listed as Field Item Relationship in the Relationship category of the blueprint editor, and its handle is field_item_relationship.
Your first field
We'll build the "team lead" example: a Grid of team members and a field that picks one of them.
1. Add a source field
Any field that stores a list can be a source. Here it is a Grid called team:
- handle: team
field:
type: grid
display: Team
fields:
- handle: name
field: { type: text, display: Name }
- handle: role
field: { type: text, display: Role }
- handle: email
field: { type: text, display: Email }
- handle: photo
field: { type: assets, display: Photo, container: assets, max_files: 1 }2. Add a Field Item Relationship field
Add a Field Item Relationship field to the same blueprint and fill in the settings:
| Setting | Value | Why |
|---|---|---|
| Source field | team | The handle of the Grid. |
| Option label source | name | Which key of each row to show as the label. |
| Option image source | photo | Optional: shows each person's photo as a thumbnail. |
| Save as | Item ID | Saves the row's ID, so renaming or reordering people keeps the selection. |
| Input type | Image grid | Shows the rows as clickable tiles. |
In YAML that is:
- handle: team_lead
field:
type: field_item_relationship
display: Team lead
source_field: team
option_label_source: name
option_image_source: photo
save_as: id
input_type: image_grid
columns: 4
aspect_ratio: 1/1Open an entry and you get a picker that is built from the Grid above it. Add a row to the Grid and it shows up in the picker straight away, before you save.


3. Use it in a template
The field saves a reference (here, the row ID). The fir tag turns that back into the row:
{{ fir:team_lead }}
<p><strong>{{ name }}</strong>, {{ role }} · {{ email }}</p>
{{ /fir:team_lead }}
{{# Or grab a single value #}}
<p>Lead: {{ fir:team_lead:name }}</p>If the source is an Assets field, you don't need the tag
Fields that pick from an Assets field are augmented to real Asset objects, so hero_image:url, hero_image:alt and Glide work directly. See Assets as source.
Next steps
- Sources: siblings, ancestors, Grid rows, Replicator sets and Global sets.
- Save as modes: which value to store, and what happens when the source changes.
- Configuration reference: every option on one page.