--- label: 'Adding a reference field to an entity sub-type' related: - core.content_structure - field_ui.add_field - field_ui.manage_display - field_ui.manage_form --- {% set content_structure = render_var(url('help.help_topic', {'id': 'core.content_structure'})) %} {% set content_types = render_var(url('entity.node_type.collection')) %}

{% trans %}Goal{% endtrans %}

{% trans %}Add an entity reference field to an entity sub-type; see Managing content structure for more information on entities and reference fields.{% endtrans %}

{% trans %}Steps{% endtrans %}

  1. {% trans %}Navigate to the page for managing the entity sub-type you want to add the field to. For example, to add a field to a content type, in the Manage administrative menu, navigate to Structure > Content types.{% endtrans %}
  2. {% trans %}Find the particular sub-type that you want to add the field to, and click Manage fields.{% endtrans %}
  3. {% trans %}Click Add field.{% endtrans %}
  4. {% trans %}In Add a new field, select the type of reference field you want to add. The Reference section of the select list shows the most common types of reference field; choose Other... if the entity type you want to reference is not listed.{% endtrans %}
  5. {% trans %}The Label field should now be visible; enter a label for the field, which is used as the field label for both content editing and content display.{% endtrans %}
  6. {% trans %}Click Save and continue.{% endtrans %}
  7. {% trans %}On the next screen, verify that the type of entity you want to reference is shown in Type of item to reference, or select it if not. Enter a value for Allowed number of values. You can limit the field to one value per entity item, a set number of values, or set it to have unlimited values. Click Save field settings.{% endtrans %}
  8. {% trans %}On the next screen, optionally edit the settings for Label, Help text (text to be displayed below the field on the content editing page), and Required field (to make it so a value must be entered in order to save the content when editing).{% endtrans %}
  9. {% trans %}In the Reference type section, you will usually want to limit the entity sub-types that can be referenced; for example, if you are creating a Content reference, you can check one or two Content type choices. The choices will be easier for content editors to scan if you also choose a sort value (normally the entity title or label field).{% endtrans %}
  10. {% trans %}Click Save settings. You should be returned to the Manage fields page, with your new field in the list.{% endtrans %}