[[structure-adding-reference]]

=== Adding a Reference Field

[role="summary"]
How to add a reference field that connects two content types.

(((Reference field,adding)))
(((Field,for adding references)))
(((Entity reference field,adding)))
(((Content reference field,adding)))
(((User reference field,adding)))
(((Taxonomy term reference field,adding)))

==== Goal

Add a reference field so that recipes can be linked to the vendor that has
submitted it.

==== Prerequisite knowledge

* <<structure-fields>>
* <<structure-reference-fields>>
* <<structure-content-type>>

==== Site prerequisites

The Recipe and Vendor content types must exist. See <<structure-content-type>>.

==== Steps

. In the _Manage_ administrative menu, navigate to _Structure_ > _Content
types_ (_admin/structure/types_). Then click _Manage fields_ in the
dropdown button for the Recipe content type. The _Manage fields_ page appears.

. Click _Add field_. The _Add field_ page appears. Fill in the fields as shown
below. Click _Save and continue_.
+
[width="100%",frame="topbot",options="header"]
|================================
|Field name | Explanation | Value
| Add a new field | Option to specify the field type | Reference > Content
| Label | The title you want to give the field | Submitted by
|================================
+
--
// Add field page for adding a Submitted by field to Recipe.
image:images/structure-adding-reference-add-field.png["Adding a reference field to a content type"]
--

. The page Submitted by appears which lets you set the allowed number of
values. Fill in the fields as shown below. Click _Save field settings_.
+
[width="100%",frame="topbot",options="header"]
|================================
|Field name | Explanation | Value
|Type of item to reference| Option to select the type of referenced item | Content
| Allowed number of values | Specify the count of values associated with the field | Limited, 1
|================================
+
--
// Field storage settings page for Submitted by field.
image:images/structure-adding-reference-set-field-basic.png["Storage configuration of a reference field "]
--

. The page _Submitted by settings for Recipe_ appears which allows you to
configure the field. Fill in the fields as shown below. Click _Save settings_.
+
[width="100%",frame="topbot",options="header"]
|================================
|Field name | Explanation | Value
| Label  | Title shown for this field on the page | Submitted by
| Help text | Brief text aiding the person creating content | Choose the vendor that submitted this recipe
| Required field | Whether a value has to be provided or not | Checked
| Reference type > Reference method | Option to select reference method | Default
| Reference type > Content types  |  Specify the content type | Vendor
| Reference type > Sort by | Sorting field | Title
| Reference type > Sort direction| Sorting order | Ascending
|================================
+
--
// Field settings page for Submitted by field.
image:images/structure-adding-reference-field-settings.png["Settings for a reference field ",width="100%"]
--

. The Submitted by field has been added to the content type.
+
--
// Manage fields page for content type Recipe, after adding Submitted by field.
image:images/structure-adding-reference-manage-fields.png["Manage fields page for the Recipe content type",width="100%"]
--

// ==== Expand your understanding

// ==== Related concepts

// ==== Additional resources


*Attributions*

Written and edited by https://www.drupal.org/u/batigolix[Boris Doesborg],
and https://www.drupal.org/u/jojyja[Jojy Alphonso] at
http://redcrackle.com[Red Crackle].
