You are here

function lingotek_update_field in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.2 lingotek.module \lingotek_update_field()
1 string reference to 'lingotek_update_field'
lingotek_form_field_ui_field_edit_form_alter in ./lingotek.module
Implements hook_form_FORM_ID_alter().

File

./lingotek.module, line 963

Code

function lingotek_update_field($form, $form_state) {
  $field_name = $form['#field']['field_name'];

  // ie:  body
  $field = field_info_field($field_name);
  $value = (int) $form['field']['lingotek_translatable']['#value'];
  if ($value == 1) {

    // This will only ever set translatable to true.  On purpose.  So that we can work alongside other translation modules.
    // If we turn it off, we can mess up other modules, and there is no harm in leaving it on.
    $field['translatable'] = TRUE;
    field_update_field($field);

    // This is needed for versions of Drupal core 7.10 and lower. See http://drupal.org/node/1380660 for details.
    drupal_static_reset('field_available_languages');

    /*
     // Working here to integrate the field cleanup process when the user selects the field to be managed by Lingotek
     // Create a Drupal Field Cleanup Batch
     debug( 'Maybe we should start a cleanup batch here.' );
     debug( $field_name );
     debug( $field );
    */
  }
}