You are here

public function LingotekBatchController::downloadSingle in Lingotek Translation 3.5.x

Same name and namespace in other branches
  1. 8 src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::downloadSingle()
  2. 8.2 src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::downloadSingle()
  3. 4.0.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::downloadSingle()
  4. 3.0.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::downloadSingle()
  5. 3.1.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::downloadSingle()
  6. 3.2.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::downloadSingle()
  7. 3.3.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::downloadSingle()
  8. 3.4.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::downloadSingle()
  9. 3.6.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::downloadSingle()
  10. 3.7.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::downloadSingle()
  11. 3.8.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::downloadSingle()
1 call to LingotekBatchController::downloadSingle()
LingotekBatchController::dispatch in src/Controller/LingotekBatchController.php

File

src/Controller/LingotekBatchController.php, line 52

Class

LingotekBatchController

Namespace

Drupal\lingotek\Controller

Code

public function downloadSingle($entity_type, $entity_id, $locales) {
  $batch = [
    'title' => $this
      ->t('Downloading translations from Lingotek'),
    'operations' => $this
      ->getDownloadOperations($entity_type, [
      $entity_id,
    ], $locales),
    'finished' => 'lingotek_operation_content_download_finished',
    'file' => drupal_get_path('module', 'lingotek') . '/lingotek.batch.inc',
  ];
  $entity = \Drupal::entityTypeManager()
    ->getStorage($entity_type)
    ->load($entity_id);
  $redirect_url = \Drupal::urlGenerator()
    ->generate("entity.{$entity_type}.content_translation_overview", [
    $entity_type => $entity_id,
  ], UrlGeneratorInterface::ABSOLUTE_URL);
  batch_set($batch);
  return batch_process($redirect_url);
}