Skip to content

Combine Address and reference fields

Prepare the content to select

Add Address to the project with composer require drupal/address. Enable Compound Field, Address, and core Taxonomy, Media, Media Library, Image and Link. Create an Image media type under Structure → Media types if the site has none. Create a Conference content type, plus these reference targets:

  • An Accessibility guide page of type Conference resource.
  • An Accessibility term in a Conference tracks vocabulary.
  • An Amina Torres portrait media item of type Image.

Create the session definition

Under Structure → Compound fields, create Conference session details. Add these optional sub-fields, each allowing one value:

Label Type Settings
Session title Short text Defaults
Venue Address Machine-name suffix loc
Portrait Media reference Image media type
Track Taxonomy reference Conference tracks vocabulary
Related content Content reference Conference resource type
Contact email Email Defaults
Session link Link Allow a link title

Use a short suffix for Address to leave room for its column property names. On Manage form display, select Media Library for Portrait. On Manage display, select rendered media for Portrait and Email link for Contact email.

Attach the compound to Conference as Featured session, allowing one value. Optionally select Inline columns in the host widget settings. The pictured layout gives Session title 100% width and the other fields 50% each.

  1. Add a Conference with Session title Opening keynote.
  2. Select United Kingdom for Venue and fill in the address and postcode. Country selection controls the address inputs and required values.
  3. Select Accessibility for Track, Amina Torres portrait through Media Library, and Accessibility guide for Related content.
  4. Enter conference@example.com and https://example.com/programme.
  5. Save, view and reopen. Check all values and reference targets.

The saved address, portrait and references.

The term, media and content page remain separate, reusable entities.