You are here

function lingotek_add_untranslated_source_fields in Lingotek Translation 7.7

1 call to lingotek_add_untranslated_source_fields()
lingotek_process_entity_xml in ./lingotek.remote.inc

File

./lingotek.remote.inc, line 393

Code

function lingotek_add_untranslated_source_fields(&$params, $source_field_data, $curr_field_data, $field_info, $entity_langcode, $delta) {
  if (empty($field_info['columns']) || empty($field_info['field_name'])) {
    return;
  }
  foreach (array_keys($field_info['columns']) as $column_name) {
    $db_column_name = $field_info['field_name'] . '_' . $column_name;

    // if it's set in the translated stuff, then don't carry over.
    if (isset($params[$db_column_name])) {
      continue;
    }
    $field_column = NULL;
    if (isset($source_field_data[$delta][$column_name])) {
      $field_column = $source_field_data[$delta][$column_name];
    }
    elseif (isset($curr_field_data[$entity_langcode][$delta][$column_name])) {
      $field_column = $curr_field_data[$entity_langcode][$delta][$column_name];
    }
    if ($field_column !== NULL) {

      // Arrays, such as those in attributes fields, should be serialized first.
      if (is_array($field_column)) {
        if (!isset($field_info['columns'][$column_name]['serialize'])) {
          $field_column = serialize($field_column);
        }
      }
      $params[$db_column_name] = $field_column;
    }
  }
}