You are here

function lingotek_grid_download_selected in Lingotek Translation 7.5

Same name and namespace in other branches
  1. 7.7 lingotek.bulk_grid.inc \lingotek_grid_download_selected()
  2. 7.6 lingotek.bulk_grid.inc \lingotek_grid_download_selected()
1 call to lingotek_grid_download_selected()
lingotek_grid_action_submit in ./lingotek.bulk_grid.inc
Submit function for The Grid's actions The action corresponds to the key of the option selected Often redirects to batch operations or to other pages entirely

File

./lingotek.bulk_grid.inc, line 677
Bulk Grid form

Code

function lingotek_grid_download_selected($entity_type, $entity_ids, $target_locales) {
  $operations = array();
  $entities = entity_load($entity_type, $entity_ids);
  foreach ($entities as $entity) {
    foreach ($target_locales as $locale) {
      $operations[] = array(
        'lingotek_entity_download',
        array(
          $entity,
          $entity_type,
          $locale,
        ),
      );
    }
  }
  $redirect = 'admin/settings/lingotek/manage/' . $entity_type;
  $batch = array(
    'title' => t('Downloading Translations'),
    'finished' => 'lingotek_sync_download_target_finished',
  );
  $batch['operations'] = $operations;
  batch_set($batch);
  batch_process($redirect);
}