You are here

function globallink_beans_save_field_collections in GlobalLink Connect for Drupal 7.7

Same name and namespace in other branches
  1. 7.6 globallink_beans/globallink_beans.inc \globallink_beans_save_field_collections()
1 call to globallink_beans_save_field_collections()
globallink_beans_import in globallink_beans/globallink_beans.inc
Gets number of translated beans.

File

globallink_beans/globallink_beans.inc, line 536

Code

function globallink_beans_save_field_collections($entity, $translated_arr, $target_locale) {
  $field_arr = field_info_instances('bean', $entity->type);
  $keys = array_keys($field_arr);
  foreach ($keys as $field) {
    $language = field_language('bean', $entity, $field, NULL);
    $field_values = field_get_items('bean', $entity, $field, $language);
    if (isset($translated_arr['field_collection'][$field])) {
      foreach ($field_values as $entity_id_arr) {
        if (isset($entity_id_arr['value'])) {
          $fc_entity_id = $entity_id_arr['value'];
          globallink_beans_save_field_collections_recursively('bean', $entity, $fc_entity_id, $translated_arr['field_collection'][$field], $target_locale);
        }
      }
    }
  }
}