You are here

function lingotek_node_disassociate_form_submit in Lingotek Translation 7.4

Submit handler for the lingotek_node_disassociate form.

File

./lingotek.page.inc, line 244
Lingotek Tab for Nodes

Code

function lingotek_node_disassociate_form_submit($form, $form_state) {
  $drupal_node_ids_json = json_decode($form_state['values']['node_id']);
  $drupal_node_ids = array();
  foreach ($drupal_node_ids_json as $nid) {
    $drupal_node_ids[] = $nid;
  }
  $doc_ids = LingotekSync::getDocIdsFromNodeIds($drupal_node_ids);
  $api = LingotekApi::instance();
  $api
    ->removeDocument($doc_ids);
  if (count($drupal_node_ids) <= 1) {
    $node = lingotek_node_load_default($drupal_node_ids[0]);
    drupal_set_message(t('Translations disassociated for "@node_title".', array(
      '@node_title' => $node->title,
    )));
  }
  else {
    drupal_set_message(t('Translations disassociated for @number nodes.', array(
      '@number' => count($drupal_node_ids),
    )));

    //    drupal_goto('admin/settings/lingotek/grid');
  }
}