function globallink_save_field_collections in GlobalLink Connect for Drupal 7.6
Same name and namespace in other branches
- 7.7 globallink_node.inc \globallink_save_field_collections()
- 7.5 globallink_node.inc \globallink_save_field_collections()
Saves field collections.
Parameters
object $node: The original node.
object $tnode: The translated node.
array $t_arr: The translated array.
1 call to globallink_save_field_collections()
- globallink_save_translated_node_with_fields in ./
globallink_node.inc - Saves translated node with fields.
File
- ./
globallink_node.inc, line 1489
Code
function globallink_save_field_collections($node, $tnode, $t_arr, $target_lang) {
$field_arr = field_info_instances('node', $node->type);
$keys = array_keys($field_arr);
foreach ($keys as $field) {
$items = field_get_items('node', $node, $field);
if ($items) {
$field_def = field_read_field($field);
if ($field_def['type'] == 'field_collection') {
if (isset($t_arr['field_collection'][$field])) {
foreach ($items as $entity_id_arr) {
if (isset($entity_id_arr['value'])) {
$fc_entity_id = $entity_id_arr['value'];
globallink_save_field_collections_recursively('node', $tnode, $fc_entity_id, $t_arr['field_collection'][$field], $target_lang);
}
}
}
}
}
}
}