Exercise 8.2: Create Agency References
Content Reference is a useful tool in GovCMS. It helps you create new relationships between content. There are many ways to leverage this connection with Views. For example, when you’re viewing an agency page, you could show which jobs “back reference” to that agency.
Create the Agency content type
Using what we’ve covered so far on content types, create a new content type using these settings:
Click Save and manage fields.
Add agency logo image field
We’re now going to add the Image field to the agency content type. When adding the field, make sure you also configure the form display and the display of the field. Use the following settings:
Field name: field_agency_logo
Field type: Media Reference (not Dynamic media reference)
Manage Form display settings
Click on the Manage form display tab. Select Entity browser from the Widget dropdown, then click the cog icon next to the Agency logo field.
Adjust the settings as shown in the screenshot below:
When finished, click the Update button and then Save the Manage form display page.
Add references field to job posting
Finally, we’re going to add a references field for job postings.
Go to Structure → Content types → Job posting and click the Manage fields link.
Add a new field using these settings:
Type: Reference → Content
Now that you’ve added the new fields, it’s time to try them out.