Field Collections: Location Term Reference
- We now need another field in our field collection, this time for Location. We will once again go to Add new field and enter in the label we want to use, but this time we will select Term reference for our Field Type and Autocomplete term widget (tagging) in the widget drop down menu.
We could use just make it a text field type, but am electing to use term reference so that we can record all locations entered into this location field into its own taxonomy. You can think of this as its own table that just stores the location information that user's have entered through your content type that can then be used as suggestions when filling out the location field in your content type the next time you used it. For instance, if you started to enter in "10" in the location field, since we have it set to Autocomplete, it will look at that taxonomy table and find all locations it has that have "10" in them and suggest them to you below.
- After you added your new term reference field for location, it will take you to the Field Settings section and ask you to select the Vocabulary which supplies the options for your location field. What it is really asking you is what Taxonomy are you going to use. You can select an existing one or you may want to create a new one to use for this field. To create a new one, got Structure -> Taxonomy and then click on the + Add vocabulary link. Now we can create the taxonomy. Enter in the Name and click Save.
- Now go back to your field collection (if you have it open in another tab, you can just refresh the page) and edit the location field and in the Field Settings section of either the Edit tab or the Field Settings tab, select the new taxonomy we just created.
We now have all of the fields we need for our custom content type. Now we just need to organize and style them.