Creating multiple value field groups in Drupal 7
on
Introduction
Drupal 7's integrated Fields API (formerly CCK) is a great step forward in allowing us to quickly create robust content types that integrate much better core. With the included Fieldgroup module, we can group fields into logical sections:
This is great for creating a single logical group containing multiple fields. We can set the number of values allowed for each field which exposes the 'Add another item' button, but what if we want to instead set the number of values allowed for this entire fieldset?
Field Collections and the Entity API
The Entity API (also part of Drupal core) provides us with more tools to accomplish this. It provides a Field Collection module that allows us to group a set of fields and treat them as a single field. Once enabled, we can add a new field of type "Field Collection" to our content type and add our fields to this collection at Admin > Structure > Field-collections.
Now we can set the number of values allowed for the collection and set the individual fields to allow one value.
Presto. Multiple value field groups. A simple example of where this might be useful would be an "about us" page that has information about employees. You could create an "employee" field collection containing a name, image, position and some biographical text and then easily add, remove, update and reorder them.