Assets as source
Point a Field Item Relationship field at an Assets field and editors pick from the images already in it. A common case is the hero image, chosen from the entry's own gallery.


Setting it up
- handle: gallery
field:
type: assets
display: Gallery
container: assets
folder: demo/photos
- handle: hero_image
field:
type: field_item_relationship
display: Hero image
source_field: gallery
save_as: value # saves the asset ID (recommended)
input_type: image_grid # thumbnails; "select" also shows thumbnails
columns: 3
aspect_ratio: 3/2- Save as must be Value (recommended) or Index. Any other mode shows a warning in the field.
- Option label source and Option image source aren't needed. Labels are the file names, and the images come from the assets themselves.
- Every input type works. The image grid and the select dropdown show thumbnails. Radio buttons and button groups show file names.
What gets saved
With Save as: Value the field saves the asset ID, which is the container handle and the path:
hero_image: 'assets::demo/photos/sunset.jpg'
featured: # with "Allow multiple"
- 'assets::demo/photos/forest.jpg'
- 'assets::demo/photos/aurora.jpg'The ID stays tied to the same image when the gallery is reordered, or when images are added or removed.
Save as: Index saves the position in the gallery (0, 1, …). If an editor reorders the gallery, the selection silently moves to whichever image is now in that position. Only use it if that is what you want.
Legacy values saved as a plain path
Older versions saved global asset sources as a plain path without the container, for example demo/logos/acme.png. These values are still recognised: the control panel shows them as selected, and templates resolve them through the source field's container (or the only container, if there is just one). Save the entry once and the value is stored as a full ID.
In templates
A field with an Assets source is augmented to the Asset itself, the same as a regular Assets field. You don't need the fir tag, but it works too.
Single image
<img src="{{ hero_image:url }}" alt="{{ hero_image:alt }}">
<p>{{ hero_image:basename }} · {{ hero_image:width }}×{{ hero_image:height }}</p>As a tag pair, you are inside the asset's context:
{{ hero_image }}
<figure>
<img src="{{ url }}" alt="{{ alt }}">
<figcaption>{{ basename }}</figcaption>
</figure>
{{ /hero_image }}Glide
Pass the field straight to Glide:
<img src="{{ glide :src="hero_image" width="1200" height="630" fit="crop" }}" alt="">Multiple images
With Allow multiple the field augments to a list of assets:
<div class="row">
{{ featured }}
<img src="{{ glide :src="url" width="240" height="240" fit="crop" }}" alt="{{ alt }}">
{{ /featured }}
</div>

hero_image:url resolves to a real asset URL.With the fir tag
The tag behaves the same way. As a single tag it prints the asset URL. As a pair it gives you the asset's fields:
<img src="{{ fir:hero_image /}}" alt="">
{{ fir:featured }}
<span class="pill">{{ basename }}</span>
{{ /fir:featured }}
<p>{{ fir:hero_image:basename }}</p>Close single tags with /}}
If a template uses the same tag both as a single tag and as a pair, close the single one with /}} (as in the first line above). Otherwise Antlers pairs it with the closing tag further down.
Global assets
A Global set's Assets field works as a source in the same way. Here is a brand logo picked from a logos field in the demo_settings global:
- handle: brand_logo
field:
type: field_item_relationship
display: Brand logo
source_type: global
source_global_set: demo_settings
source_field: logos
save_as: value
input_type: image_grid
columns: 4
aspect_ratio: 16/9

<img src="{{ brand_logo:url }}" height="90" alt="">In listings
In entry listings, the column of a FIR field with an Assets source shows the selected file names instead of raw IDs.