public function LingotekBatchController::dispatch in Lingotek Translation 3.3.x
Same name and namespace in other branches
- 8 src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::dispatch()
- 8.2 src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::dispatch()
- 4.0.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::dispatch()
- 3.0.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::dispatch()
- 3.1.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::dispatch()
- 3.2.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::dispatch()
- 3.4.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::dispatch()
- 3.5.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::dispatch()
- 3.6.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::dispatch()
- 3.7.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::dispatch()
- 3.8.x src/Controller/LingotekBatchController.php \Drupal\lingotek\Controller\LingotekBatchController::dispatch()
1 string reference to 'LingotekBatchController::dispatch'
File
- src/
Controller/ LingotekBatchController.php, line 10
Class
Namespace
Drupal\lingotek\ControllerCode
public function dispatch($action, $entity_type, $entity_id) {
/** @var \Drupal\lingotek\LingotekContentTranslationServiceInterface $translation_service */
$translation_service = \Drupal::service('lingotek.content_translation');
/** @var \Drupal\lingotek\LingotekConfigurationServiceInterface $configuration_service */
$configuration_service = \Drupal::service('lingotek.configuration');
/** @var \Drupal\lingotek\Lingotek $lingotek */
$lingotek = \Drupal::service('lingotek');
$entity = \Drupal::entityTypeManager()
->getStorage($entity_type)
->load($entity_id);
// This forces the hash to be set.
if ($translation_service
->hasEntityChanged($entity)) {
$entity
->save();
}
$profile = $configuration_service
->getEntityProfile($entity, TRUE);
switch ($action) {
case 'uploadSingle':
return $this
->uploadSingle($entity_type, $entity_id, $profile);
case 'downloadSingle':
return $this
->downloadSingle($entity_type, $entity_id, $profile);
default:
return $this
->noAction();
}
}