You are here

function lingotek_update_7403 in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lingotek.install \lingotek_update_7403()
  2. 7.4 lingotek.install \lingotek_update_7403()
  3. 7.5 lingotek.install \lingotek_update_7403()

Removes the deprecated "Lingotek Translatable" option from each field

File

./lingotek.install, line 575

Code

function lingotek_update_7403(&$sandbox) {
  $translate_fields = variable_get('lingotek_translate_fields');
  if (empty($translate_fields)) {
    $types = _node_types_build()->types;
    $translate_fields = array();
    foreach ($types as $t) {
      $translation_setting = variable_get('language_content_type_' . $t->type);
      if ($translation_setting == 'lingotek') {
        variable_set('language_content_type_' . $t->type, "1");
        $fields = field_info_instances("node", $t->type);
        foreach ($fields as $field_name => $instance) {
          $field = field_info_field($field_name);
          if ($field['translatable'] && $field['lingotek_translatable'] == 1) {
            $translate_fields[$t->type][] = $field_name;
          }
        }
      }
    }
    variable_set('lingotek_translate_fields', $translate_fields);
  }
}