You are here

function lingotek_setup_node_translation_settings_form_submit in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lingotek.setup.inc \lingotek_setup_node_translation_settings_form_submit()
  2. 7.2 lingotek.setup.inc \lingotek_setup_node_translation_settings_form_submit()
  3. 7.3 lingotek.setup.inc \lingotek_setup_node_translation_settings_form_submit()
  4. 7.4 lingotek.setup.inc \lingotek_setup_node_translation_settings_form_submit()
  5. 7.5 lingotek.setup.inc \lingotek_setup_node_translation_settings_form_submit()

Node Translation Settings - Form Submit

File

./lingotek.setup.inc, line 763

Code

function lingotek_setup_node_translation_settings_form_submit($form, &$form_state) {
  lingotek_admin_entity_bundle_profiles_form_submit($form, $form_state);
  if ($form_state['values']['lingotek_nodes_translation_method'] == 'node' && $form_state['values']['lingotek_overwrite']) {
    $nodes = db_select('node', 'n')
      ->fields('n', array(
      'nid',
      'tnid',
    ))
      ->where('n.nid <> n.tnid AND n.tnid <> 0')
      ->execute()
      ->fetchAll();
    $ops = array();
    foreach ($nodes as $row) {
      $ops[] = array(
        'lingotek_keystore',
        array(
          'node',
          $row->nid,
          'profile',
          LingotekSync::PROFILE_DISABLED,
        ),
      );
      $ops[] = array(
        'lingotek_keystore',
        array(
          'node',
          $row->nid,
          'upload_status',
          LingotekSync::STATUS_TARGET,
        ),
      );
    }
    $batch = array(
      'operations' => $ops,
    );
    batch_set($batch);
    batch_process(lingotek_get_entity_setup_path('node', TRUE));
  }
  else {
    drupal_goto(lingotek_get_entity_setup_path('node', TRUE));
  }
}