You are here

function lingotek_batch_disassociate_content in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.4 lingotek.batch.inc \lingotek_batch_disassociate_content()
  2. 7.5 lingotek.batch.inc \lingotek_batch_disassociate_content()
  3. 7.6 lingotek.batch.inc \lingotek_batch_disassociate_content()

Batch Create: Lingotek Disassociate Translations

File

./lingotek.batch.inc, line 280
Central location for batch create functions, before control is handed off to individual batch command files.

Code

function lingotek_batch_disassociate_content() {
  $doc_ids = LingotekSync::getAllLocalDocIds();
  $api = LingotekApi::instance();
  $operations = array();

  /*
   //one at a time
   foreach ($doc_ids as $doc_id) {
   $operations[] = array('lingotek_batch_disassociate_content_worker', array($api, $doc_id));
   }
  */

  // all at once
  $operations[] = array(
    'lingotek_batch_disassociate_content_worker',
    array(
      $api,
      $doc_ids,
    ),
  );
  $operations[] = array(
    'LingotekSync::disassociateAllEntities',
    array(),
  );
  $operations[] = array(
    'LingotekSync::disassociateAllSets',
    array(),
  );
  drupal_set_message(t('All local translations have been disassociated from Lingotek.'));
  $batch = array(
    'title' => t('Disassociating Translations'),
    'operations' => $operations,
  );
  batch_set($batch);
  batch_process('admin/settings/lingotek/settings');
}