I can't export a field collection which is only defined in another field collection. Nowhere in the Features interface a "field instance" for the second field collection is selectable for export.

Since Features 7.x-2.0-beta2 fields are divided into two parts, base and instance. I think that is what is causing my problem.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wizonesolutions’s picture

Priority: Normal » Major

I have the same problem. Did you ever find a workaround in the end?

I'm going to dare to raise this to major and hopefully get some attention on it. Also, I'll see if it's a quick fix, e.g. what they did in Features itself to make this work with nodes.

wizonesolutions’s picture

Version: 7.x-1.0-beta5 » 7.x-1.x-dev

Alright, I have found a solution. It's really simple. The function field_collection_features_pipe_field_alter in field_collection.module needs to be renamed to field_collection_features_pipe_field_instance_alter.

It appears Features doesn't call the former anymore.

My version of Field Collection is already patched, so I can't provide a patch quite yet, but I will do some Git magic and post one soon.

wizonesolutions’s picture

Oh, forgot one thing. Change:

$pipe['field'][] = "{$field['entity_type']}-{$field['bundle']}-{$field['field_name']}";

to:

$pipe['field_instance'][] = "{$field['entity_type']}-{$field['bundle']}-{$field['field_name']}";
wizonesolutions’s picture

Status: Active » Needs review
FileSize
1.18 KB

Here's the patch.

Status: Needs review » Needs work

The last submitted patch, 1982184_export_instances_4.patch, failed testing.

technicalknockout’s picture

Status: Needs work » Needs review
FileSize
1.02 KB

Looks like you might have built the patch in a repository other than the module's - just learning how to make these patches myself so I figured I'd give re-rolling it a try.

DamienMcKenna’s picture

Status: Needs review » Needs work

This needs to support both the old and new APIs, for sites that have not upgraded to Features v2 yet.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
2.15 KB

This patch adds field_collection_features_pipe_field_instance_alter() instead of replacing field_collection_features_pipe_field_alter(). It also adds a check to see if the new field_instance functionality is available before field_collection_features_pipe_field_alter() returns anything, to avoid unnecessarily causing problems by defining both the new 'field_instances' and the legacy 'field' values. Lastly, the docbook comments have been made more verbose to explain what is going on.

wizonesolutions’s picture

Thanks for the rerolls :)

pcoucke’s picture

This patch works for me on field collection 7.x-1.0-beta5 with features 7.x-2.0-rc1.

acrollet’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #8 also works nicely for me.

fago’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.