Overview
Use this fieldtype to create a one-way relationship with entries of any collection in your site. It's delightfully simple.
Data Structure
This fieldtype will store an array of ids to the selected entries. They will be augmented in your Antlers templates to give you access to each entry's data.
related_entries:
- 12f9be1f-a12e-4680-b769-639d2d1f1d14
- ea48926d-bf67-4d45-9420-9627a31c37fb
Templating
Loop through the entries and do anything you want with the data.
<ul>
{{ related_entries }}
<li><a href="{{ url }}">{{ title }}</a></li>
{{ /related_entries }}
</ul>
<ul>
<li><a href="/look-at-this">Look at This!</a></li>
<li><a href="/look-at-that">Wait, Look at That!</a></li>
</ul>
Options
collections
Configure which collections you want to allow relationships with.
max_items
The maximum number of items that may be selected. Setting this to 1
will change the UI to a dropdown.
mode
Set the UI style for this field. Can be one of 'default' (Stack Selector), 'select' (Select Dropdown) or 'typeahead' (Typeahead Field).
query_scopes
Allows you to specify a query scope which should be applied when retrieving selectable assets. You should specify the query scope's handle, which is usually the name of the class in snake case. For example: MyAwesomeScope
would be my_awesome_scope
.
search_index
Allows you to specify a search index to be used when searching for entries.