Entity reference form element
The Entity reference form element has been superseded by the Entity browser form element which offers more features for controlling the View mode used to display the entity.
Use the Entity reference form element to add an Entity reference field to your Component form. For more information, see Create an editable component and Entity reference element.
Locating the Entity reference form element
To find the Entity reference form element:
- Navigate to a component
- Click the + button on the Component form builder
- Click the drop-down arrow and select the Fields option
- Within the Fields list, look for the Entity reference form element.
The Entity reference form element includes the following fields:
- Field label - Provide a name for the form element. The field label will be displayed above the field in your component form. Important: It will also be used to auto-generate the field machine name. Auto generation only occurs until you have clicked Apply.
- Machine name - Set the machine name of the field. Used as a token when linking an element to the field. Must be unique within the component. Important: If you need to change the machine name later, click the Edit icon on the field's right.
- Entity type - Select the type of content that you want to reference
- Disable Entity type selection - Use this toggle to prevent the Entity type from being edited by a user.
- View mode - Select the view mode you would like the entity to use when displaying on the page, for example select teaser to display the referenced entity using the teaser view mode.
- Prevent editing of View mode - Use this toggle to prevent the View mode from being edited by a user. Note: This option is only available if the Prevent editing of Entity type toggle is selected.
- Entity - Start typing the title of the entity that you would like to be displayed on the page, a list of entities matching what you have typed in will appear below the text field. Click on the entity that you would like to be displayed.
- Show field if - Enter conditional logic to show / hide the field based on the value of another field. For more, see Component fields conditional visibility.
- Tooltip text - Enter tooltip text here.
- Tooltip placement - Define the position of the tooltip on hover of the field.