Content Fields: References
In many cases you want to reference objects from another Content Type. For example, when you’re creating a gallery, you want the user to be able to add one or more gallery items. However, these gallery items are standalone objects with a Content Type and Content Fields themselves. To accomplish this you use the References field.
When creating a References field, you pick a Content Type to reference. The user chooses from all of this content type’s objects from a list in the edit screen. Since there needs to be a value to recognize the referenced objects in this list, you also need to select a text field that is used to represent the object in this list. This is done in the dropdown under ‘Title field that represents the object in the reference list’. If the referenced content type does not have a text field, you cannot choose it to reference it.
The values of the selected field turn up in the reference field’s list of records, like this:
Reference context
You also need to pick a so-called ‘Context’ for the Reference field. You can choose from Global context and Local context.
Global context
The user can pick an object from a list of existing objects that belong to the designated content type, or create a new one. This context is used if you need to add one or more authors to a news article, for example. The same authors are added to other news articles, and those references need to link to the same object.
Local context
Every time the user adds a reference, a new object of the designated content type gets created. Let’s stick with the example of the image gallery: every time a gallery gets added a gallery item, a new record needs to be created, since other galleries do not need to reference that exact same object.
The distinction between these two contexts was made to prevent multiple objects with the exact same attributes being created. In the case of the author for news articles, every news article that has a reference to a certain author, references to the same author object. If an attribute for the author changes, i.e. the author’s age, this change needs to be reflected in every reference to the author. So before picking a context, ask yourself: ‘can there be multiple references to the same object in my project?’ If so, pick global. If not, pick local.