function lingotek_operation_content_download_finished in Lingotek Translation 3.0.x
Same name and namespace in other branches
- 8 lingotek.batch.inc \lingotek_operation_content_download_finished()
- 8.2 lingotek.batch.inc \lingotek_operation_content_download_finished()
- 4.0.x lingotek.batch.inc \lingotek_operation_content_download_finished()
- 3.1.x lingotek.batch.inc \lingotek_operation_content_download_finished()
- 3.2.x lingotek.batch.inc \lingotek_operation_content_download_finished()
- 3.3.x lingotek.batch.inc \lingotek_operation_content_download_finished()
- 3.4.x lingotek.batch.inc \lingotek_operation_content_download_finished()
- 3.5.x lingotek.batch.inc \lingotek_operation_content_download_finished()
- 3.6.x lingotek.batch.inc \lingotek_operation_content_download_finished()
- 3.7.x lingotek.batch.inc \lingotek_operation_content_download_finished()
- 3.8.x lingotek.batch.inc \lingotek_operation_content_download_finished()
1 string reference to 'lingotek_operation_content_download_finished'
- LingotekBatchController::downloadSingle in src/
Controller/ LingotekBatchController.php
File
- ./
lingotek.batch.inc, line 129 - Lingotek batch functions
Code
function lingotek_operation_content_download_finished($success, $results, $operations) {
if (isset($results['error'])) {
$error_message = [
'#type' => 'inline_template',
'#template' => 'Some operations failed: {{ errors }}',
'#context' => [
'errors' => [
'#theme' => 'item_list',
'#items' => $results['error'],
],
],
];
\Drupal::messenger()
->addError(\Drupal::service('renderer')
->renderPlain($error_message));
}
$count = !empty($results['downloads']) ? $results['downloads'] : 0;
$message = \Drupal::translation()
->formatPlural($count, 'Downloaded a document from Lingotek.', 'Downloaded @num documents from Lingotek.', [
'@num' => $count,
]);
if (isset($results['error'])) {
\Drupal::messenger()
->addWarning($message);
}
else {
\Drupal::messenger()
->addStatus($message);
}
}