Structures Fieldtype

For when you need to create a relationship to one or more structures. This could be useful to pick which version of a sidebar or footer to include on a page, or other similar things.

structures.png Fieldtype UI
Behold! The Structures Fieldtype!

Overview

Use this fieldtype to create a one-way relationship with one or more structures in your site. It’s a simple-little-helper type of thing.

Data Structure

This fieldtype will store the handle or handles of the structured collection. They will be augmented in your Antlers templates to work exactly like the nav tag.

shown_structures:
  - main_nav
  - footer

Templating

Loop through the structure collecctions with access to all of the entries.

<ul>
  {{ shown_structures }}
    <li><a href="{{ url }}">{{ title }}</a></li>
  {{ /shown_structures }}
</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>

Config Options

max_items integer

The maximum number of items that may be selected. Setting this to 1 will automatically change the UI to a dropdown.

mode string

Sets the UI mode for choosing your structures. Pick between Stack Selector, Select Dropdown, or Typeahead Field.

Betterify this page on Github!