As with so many of the tutorials we write, this tutorial started as a question in our support forums.
One of our members wanted to set up three image fields and then re-use them across multiple content types.
Our solution was to recommend the Field Collection module.
Field Collection allows you (as the name implies) to collect some fields together into a group. You can then re-use those fields for multiple content types, users, comments or really whenever you add fields.
Here's how to use the Field Collection module.
#1. Set up the modules
#2. Add a Field Collection field
- Go to Structure > Content types.
- Add a field of the type "Field collection".
#3. Set up the Field collection fields
- Go to Structure > Field collections.
- You'll see the field that you created.
- Click manage fields.
You'll now see an area very similar to your content type screen. Essentially your "field collection" is an entity that you can add fields to. If you're not sure what an entity is, read our introduction to Entites.
In this example, I'm going to add three image fields:
#4. Use the fields
Back in Step #2, you added the field collection to a content type. Click "Add content" and you'll find your reusable images are attached to the content and ready to use:
#5. Re-use the Field collection
Now that your Field collection is ready, you can use it with any other entity on your site.
You can use the whole Field collection or individual fields within the Field collection: