Blog

Drupal Field Collection Feeds Import

Jason Narog
, Drupal Developer

Drupal Feeds Monster

Love using feeds but have a field collection on your content type and need to bulk import to that as well? Well, thankfully there’s a module for that – the Field collection feeds module. This module won’t let you import all your content in one fell swoop, but it will allow you to update your content types that have field collections with a few cut and pastes of your working xml file or excel spreadsheet.

After enabling the module, start by setting up your feeds the same way you typically would with a unique name, fetcher, etc. If this is your first time working with feeds, take a look at our previous article on using feeds for data imports.

When you get to “processor” select the new “field collection processor” option. Under settings, select the field collection bundle you would like to work with. Choose “update existing field collection item” for your update option. Select the field name associated with your content type.

Your host entity type will be node (most likely.) This is where things get a little tricky. For field/property name of host entity GUID I used “nid.” This allows me to use the existing node ID’s of my already imported content to correctly map the field collection to. Set your identifier field name to a unique field attached to your field collection, eg field_myfield and click save. Under “mapping” make sure you add a source field for your nid’s and choose the target of “Host Enttiy GUID.” Also, map your field_myfield value from above to “Identifier field.” Add the rest of the fields you wish to import and click save.

Host entity GUID and Identifier are the two most confusing fields for the entire import. Using nid above as Host entity GUID is tested as of this article’s post date using feeds 7.x-2.0-alpha8, field collection 7.x-1.0-beta7, and field collection feeds 7.x-1.0-alpha3. There is a newer version of field collection available, and this configuration setup has not been tested using the latest update yet.

 

► Website not looking or working right?
► Tell us about it.

 

Comments
Oh man, this is the hardest module to figure out. I've got nested field collections and it is impossible to keep the wording of this thing straight. I still am stuck, but you've cleared up a thing or two for me. Thanks!
Add new comment