Drupal 7 Field Collection Module Tutorial

What is this module used for? 

 

The Drupal 7 field collection module is used to easily create fields within fields. A good example would be on an e-commerce website where you have product specifications or data you would like to present in an organized manner. You also have the ability to reuse these fields on other parts of your website. The field collection views module allows you to display the field collections.

drupal field collection module

1. First install the field collection module and field collection views modules. You will also need to install the field entity API module. 

 

 

 

 

 

 

2. Select or create the content type you would like to use the field collections. Create a new field and select the field type “field collection” and the widget is embedded. 

 

drupal field collection module

 

 

 

 

 

 

3. Within your new field collection field you can now add fields. This is done in structure>field collections. You can see that I added product specs to my product content type. I have one field for the spec name and one for the spec data.

 

 

 

 

4. Now that the field collection has been created, I can add product specs when creating new products. I selected unlimited earlier when creating this field collection, so this allows me to make unlimited product specs using the name and data fields.drupal field collection module

 

 

 

 

5. To properly display the field collections you will be using the field collection views module. In the content type structure, goto the manage display section. Under your field collection field select the display format as Views field-collection items.

drupal field collection module

 

drupal field collection module

 

 

 

 

 

 

 

6. You will need to go into the view and modify how you would like the field collections to be displayed. I normally clone this view as a backup because if you accidentally delete the wrong field in the view it will break. I added the field collection items to my view and removed any additional items that I did not want displayed. This gives the nice clean product specs section on my product content type.