You are here

function _bc_copy_field_collection_export in Bundle Copy 7.2

Helper function to load the fields of field collection field. Also it load recursively if field collection field exists inside a field collection.

Parameters

$fields: The info of all fields.

$fcfield: The name of the field Collection field.

1 call to _bc_copy_field_collection_export()
_bundle_copy_export_data in ./bundle_copy.module
Creates export data.

File

./bundle_copy.module, line 591
Bundle copy.

Code

function _bc_copy_field_collection_export($fields, $fcfield) {
  $fc_fields_data = array();
  $fc_field_instances = field_info_instances('field_collection_item', $fcfield);
  foreach ($fc_field_instances as $fc_fkey => $fc_finfo) {
    unset($fc_field_instances[$fc_fkey]['id']);
    unset($fc_field_instances[$fc_fkey]['field_id']);
    $fc_fields_data[$fc_fkey]['instance'] = $fc_field_instances[$fc_fkey];
    if ($fields[$fc_fkey]['type'] == 'field_collection' && $fields[$fc_fkey]['module'] == 'field_collection') {
      $fc_fields_fc_fields_data = _bc_copy_field_collection_export($fields, $fields[$fc_fkey]['field_name']);
      $fc_fields_data = array_merge($fc_fields_data, $fc_fields_fc_fields_data);
    }
  }
  return $fc_fields_data;
}