You are here

function tmgmt_content_create_continuous_job_items_batch_finished in Translation Management Tool 8

Creates continuous job items for entity.

Batch callback function.

1 string reference to 'tmgmt_content_create_continuous_job_items_batch_finished'
ContentEntitySourcePluginUi::overviewSubmitToContinuousJobs in sources/content/src/ContentEntitySourcePluginUi.php
Adds selected sources to continuous jobs.

File

sources/content/tmgmt_content.module, line 346
Source plugin for the Translation Management system that handles entities.

Code

function tmgmt_content_create_continuous_job_items_batch_finished($success, $results, $operations) {
  if ($success) {
    if ($results['job_items'] !== 0) {
      \Drupal::messenger()
        ->addStatus(\Drupal::translation()
        ->formatPlural($results['job_items'], '1 continuous job item has been created.', '@count continuous job items have been created.'));
    }
    else {
      \Drupal::messenger()
        ->addWarning(t('None of the selected sources can be added to continuous jobs.'));
    }
  }
  else {

    // An error occurred.
    $error_operation = reset($operations);
    $message = t('An error occurred while processing %error_operation with arguments: @arguments', array(
      '%error_operation' => $error_operation[0],
      '@arguments' => print_r($error_operation[1], TRUE),
    ));
    \Drupal::messenger()
      ->addError($message);
  }
}